A small, fast library for working with structured data
If you are new, start with the quick start below and move to the reference when you need details.
Features
- mergeConfig(base, overrides). Combines two configuration objects, giving priority to the second and keeping types intact.
- retryTask(task, attempts). Runs an asynchronous task again if it fails, with a short delay between attempts.
- formatRecord(record, template). Renders a record using a template string with named placeholders.
- parseInput(value, schema). Validates a value against a schema and returns the cleaned result or a list of errors.
Installation
pnpm add datumQuick start
import { mergeConfig } from "datum";
const result = mergeConfig(input, { strict: true });
console.log(result);