Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
validate-it
Advanced tools
Decalarative validator for JS
$ npm install validate-it
var validateIt = require('validate-it');
At least you must specify the name of the object to validate
It's check that data's property password is not undefined:
var rule = {name: 'password'};
var data = {password: 'qwerty'};
validateIt(data, rule); // => {}
Rules can be an array:
var rules = [
{name: 'password'},
{name: 'login'}
];
var data = {password: 'qwerty'};
validateIt(data, rules); // => { login: 'Is required' }
Built-in validators
Will be used only if it is declared in the rule!
empty
var data = {login: ''};
var rule = {name: 'login', empty: false};
validateIt(data, rule); // => { login: 'Is empty' }
len
var data = {login: 'short'};
var rule = {
name: 'login',
len: [9, 20]
};
validateIt(data, rule); // => { login: 'Expected [9,20] symbols. Given: 5' }
var data = {login: 'short'};
var rule = {name: 'login', len: 6};
validateIt(data, rule); // => { login: 'Expected min 6 symbols. Given: 5' }
MIT
FAQs
declarative validator
The npm package validate-it receives a total of 1 weekly downloads. As such, validate-it popularity was classified as not popular.
We found that validate-it demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.