MCPcopy Index your code
hub / github.com/fastify/fast-json-stringify / validate13

Function validate13

lib/schema-validator.js:37–69  ·  view source on GitHub ↗
(data, {instancePath="", parentData, parentDataProperty, rootData=data}={})

Source from the content-addressed store, hash-verified

35const root1 = {validate: validate10};
36
37function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
38let vErrors = null;
39let errors = 0;
40if(errors === 0){
41if(Array.isArray(data)){
42if(data.length < 1){
43validate13.errors = [{instancePath,schemaPath:"#/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"}];
44return false;
45}
46else {
47var valid0 = true;
48const len0 = data.length;
49for(let i0=0; i0<len0; i0++){
50const _errs1 = errors;
51if(!(root1.validate(data[i0], {instancePath:instancePath+"/" + i0,parentData:data,parentDataProperty:i0,rootData}))){
52vErrors = vErrors === null ? root1.validate.errors : vErrors.concat(root1.validate.errors);
53errors = vErrors.length;
54}
55var valid0 = _errs1 === errors;
56if(!valid0){
57break;
58}
59}
60}
61}
62else {
63validate13.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"}];
64return false;
65}
66}
67validate13.errors = vErrors;
68return errors === 0;
69}
70
71const func0 = require("ajv/dist/runtime/equal").default;
72

Callers 1

validate10Function · 0.85

Calls 1

validateMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…