API reference
Every public function with its arguments, return values and a short example.
retryTask(task, attempts)
Runs an asynchronous task again if it fails, with a short delay between attempts.
import { retryTask } from "kernelpop";
const result = retryTask(input, { strict: true });
console.log(result);formatRecord(record, template)
Renders a record using a template string with named placeholders.
import { formatRecord } from "kernelpop";
const result = formatRecord(config, { strict: true });
console.log(result);watchChanges(target, handler)
Calls the handler every time the target changes and returns a function to stop watching.
import { watchChanges } from "kernelpop";
const result = watchChanges(config, { strict: true });
console.log(result);createStore(options)
Creates a store from the given options and returns an object with read and write methods.
import { createStore } from "kernelpop";
const result = createStore(items, { strict: true });
console.log(result);batchUpdate(items, size)
Splits a list into groups of the given size and processes them in order.
import { batchUpdate } from "kernelpop";
const result = batchUpdate(data, { strict: true });
console.log(result);mergeConfig(base, overrides)
Combines two configuration objects, giving priority to the second and keeping types intact.
import { mergeConfig } from "kernelpop";
const result = mergeConfig(items, { strict: true });
console.log(result);serializeState(state)
Converts the current state to a compact string that can be restored later.
import { serializeState } from "kernelpop";
const result = serializeState(config, { strict: true });
console.log(result);parseInput(value, schema)
Validates a value against a schema and returns the cleaned result or a list of errors.
import { parseInput } from "kernelpop";
const result = parseInput(config, { strict: true });
console.log(result);