Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

ajv JTD instanceof

node v14.20.1
version: 1.0.0
endpointsharetweet
/* Attempting to use ajv-keywords with JTD. https://github.com/ajv-validator/ajv-keywords#usage https://ajv.js.org/json-type-definition.html#user-defined-keywords */ const Ajv = require("ajv/dist/jtd") const ajv = new Ajv( {keywords: [ require("ajv-keywords/dist/definitions/instanceof")() ]} ); // require("ajv-keywords")(ajv, "instanceof") // const schema = {type:"timestamp",instanceof:"Array"}; // const validate = ajv.compile(schema); // console.log("is Date valid?:",validate(new Date())); // console.log("is ISO string valid?:",validate(new Date().toISOString()));
Loading…

no comments

    sign in to comment