fastest-validator
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -1,3 +0,1 @@ | ||
/* eslint-disable no-console */ | ||
let Validator = require("../index"); | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* eslint-disable no-console */ | ||
"use strict"; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* eslint-disable no-console */ | ||
let Validator = require("../index"); | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* eslint-disable no-console */ | ||
let Validator = require("../index"); | ||
@@ -8,5 +6,5 @@ | ||
const schema = { | ||
id: { type: "number", positive: true, integer: true }, | ||
name: { type: "string", min: 3, max: 255 }, | ||
status: "boolean" // short-hand def | ||
id: { type: "number", positive: true, integer: true }, | ||
name: { type: "string", min: 3, max: 255 }, | ||
status: "boolean" // short-hand def | ||
}; | ||
@@ -13,0 +11,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* eslint-disable no-console */ | ||
let Validator = require("../index"); | ||
@@ -4,0 +2,0 @@ |
"use strict"; | ||
let defaultsDeep = require("lodash.defaultsdeep"); | ||
let flatten = require("lodash.flatten"); | ||
let defaultMessages = require("./messages"); | ||
let glob = require("glob"); | ||
let path = require("path"); | ||
const defaultsDeep = require("lodash.defaultsdeep"); | ||
const flatten = require("lodash.flatten"); | ||
const defaultMessages = require("./messages"); | ||
function loadRules() { | ||
return { | ||
any: require("./rules/any"), | ||
array: require("./rules/array"), | ||
boolean: require("./rules/boolean"), | ||
custom: require("./rules/custom"), | ||
date: require("./rules/date"), | ||
email: require("./rules/email"), | ||
forbidden: require("./rules/forbidden"), | ||
function: require("./rules/function"), | ||
number: require("./rules/number"), | ||
object: require("./rules/object"), | ||
string: require("./rules/string"), | ||
url: require("./rules/url") | ||
}; | ||
} | ||
/** | ||
@@ -22,9 +37,3 @@ * Validator class constructor | ||
// Load rules | ||
this.rules = {}; | ||
let files = glob.sync(path.join(__dirname, "rules", "*.js")); | ||
files.forEach(file => { | ||
const name = path.parse(file).name; | ||
this.rules[name] = require(file); | ||
}); | ||
this.rules = loadRules() | ||
} | ||
@@ -129,6 +138,6 @@ | ||
iterate: true | ||
}); | ||
}); | ||
} | ||
return checks; | ||
return checks; | ||
}; | ||
@@ -135,0 +144,0 @@ |
{ | ||
"name": "fastest-validator", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "The fastest JS validator library for NodeJS", | ||
"main": "index.js", | ||
"browser": "dist/browser/index.js", | ||
"scripts": { | ||
"bench": "node benchmark/index.js", | ||
"build": "rollup -c", | ||
"prepublish": "npm run build", | ||
"dev": "nodemon examples/index.js", | ||
"ci": "jest --watch", | ||
"test": "jest --coverage", | ||
"lint": "eslint --ext=.js src test", | ||
"lint": "eslint --ext=.js src test rollup.config.js", | ||
"deps": "npm-check -u", | ||
@@ -34,6 +37,9 @@ "coverall": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" | ||
"coveralls": "^2.12.0", | ||
"eslint": "4.1.1", | ||
"eslint": "4.6.1", | ||
"jest": "20.0.4", | ||
"jest-cli": "20.0.4", | ||
"npm-check": "5.4.4" | ||
"npm-check": "5.4.4", | ||
"rollup": "^0.49.2", | ||
"rollup-plugin-buble": "^0.15.0", | ||
"rollup-plugin-commonjs": "^8.2.0" | ||
}, | ||
@@ -40,0 +46,0 @@ "dependencies": { |
@@ -467,7 +467,7 @@ "use strict"; | ||
10 | ||
], | ||
], | ||
[ | ||
1, | ||
2 | ||
] | ||
] | ||
] | ||
@@ -483,11 +483,11 @@ }; | ||
let obj = { | ||
arr1: [ | ||
arr1: [ | ||
[ | ||
5, | ||
10 | ||
], | ||
], | ||
[ | ||
"1", | ||
2 | ||
] | ||
] | ||
] | ||
@@ -497,3 +497,3 @@ }; | ||
let res = check(obj); | ||
expect(res.length).toBe(1); | ||
@@ -506,9 +506,9 @@ expect(res[0].type).toBe("number"); | ||
let obj = { | ||
arr1: [ | ||
arr1: [ | ||
[ | ||
], | ||
], | ||
[ | ||
1, | ||
2 | ||
] | ||
] | ||
] | ||
@@ -515,0 +515,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
405709
55
8713
2
9
2