ajv JTD instanceof

node v14.16.0
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