MCPcopy Create free account
hub / github.com/fastify/fast-json-stringify / validate11

Function validate11

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

Source from the content-addressed store, hash-verified

12const schema13 = {"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]};
13
14function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
15let vErrors = null;
16let errors = 0;
17const _errs1 = errors;
18if(!(((typeof data == "number") && (!(data % 1) && !isNaN(data))) && (isFinite(data)))){
19validate11.errors = [{instancePath,schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];
20return false;
21}
22if(errors === _errs1){
23if((typeof data == "number") && (isFinite(data))){
24if(data < 0 || isNaN(data)){
25validate11.errors = [{instancePath,schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];
26return false;
27}
28}
29}
30validate11.errors = vErrors;
31return errors === 0;
32}
33
34const schema15 = {"type":"array","minItems":1,"items":{"$ref":"#"}};
35const root1 = {validate: validate10};

Callers 1

validate10Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…