@nrfcloud/validate-with-typebox
v1.0.6
Published
Helper function to validate data with TypeBox schemas.
Maintainers
Keywords
Readme
@nrfcloud/validate-with-typebox
https://www.npmjs.com/package/@nrfcloud/validate-with-typebox
Helper function to validate data with TypeBox schemas.
Install with NPM
npm i (--save-prod|--save-dev) @nrfcloud/validate-with-typeboxUsage
import { fetchWithDebug } from "@nrfcloud/validate-with-typebox";
import assert from "node:assert/strict";
const validateInput = validateWithTypeBox(
Type.Object({
email: Type.RegExp(/.+@.+/),
}),
);
assert.equal(
formatTypeBoxErrors(
(
validateInput({
email: "f",
}) as any
).errors,
),
`/email: Expected string to match regular expression`,
);TypeScript 6 and 7
This repo runs TypeScript 6 and 7 side by side, so that eslint works.
