
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
A strict validator in nodeJs ,check for string, integer, email, etc. Support batch check.
npm install cck --save
cck.check
var t = {name:'dd',age:23};
cck.check(t.name,'strLen',[3,5]); //false
cck.check(t.age,'intRange',[15,50]); //true
cck.checkBatch
var t = {name:'dd',age:23};
var arr = [[t.name,'notNull'],[t.age,'intRange',[1,200]],[t.xy,'notNull'],[t.name,null,/^[d]+$/]];
var re = cck.checkBatch(arr); //return [2] ,the failed index or arr
var cck = reqire('cck');
//check number,int,string...
cck.check(2,'number'); //true
cck.check(-2,'int'); //true
cck.check(2.1,'int'); //false
cck.check(2.1,'string'); //false
//check int in range, the range include start and end
cck.check(32,'intRange',[20,35]); //true
cck.check(32,'intRange',[20,32]); //true
cck.check(32,'intRange',[32,35]); //true
cck.check(32,'intRange',[32]); //true
cck.check(32,'intRange',32); //true
cck.check(32,'intRange',[1,31]); //false
//check string length in range, include start and end
cck.check('55555','strLen',5); //true
cck.check('9','strLen',10); //false
cck.check('aD-',strLen,[-3,10]); //true
cck.check('',strLen,0); //true
cck.check('2','strLen',[2]); //false
cck.check('22','strLen',[2]); //true
cck.check('22','strLen',[2,3,5]); //true
cck.check('333','strLen',[2,3,5]); //true
cck.check('4444','strLen',[2,3,5]); //false
cck.check('22','strLen',[1,2]); //true
cck.check('22','strLen',[0,1]); //fals
//custom check regExp
cck.check('55555',null,/^[\d]+$/); //true
cck.check('9',null,10); //false
//check batch
var t = {name:'dd',age:23};
var arr = [[t.name,'notNull'],[t.age,'intRange',[1,200]],[t.xy,'notNull'],[t.name,null,/^[d]+$/]];
var re = cck.checkBatch(arr); //return [2] ,the failed index or arr
/**
* millisecond to 'yyyy-MM-dd hh:mm:ss'
* @param {int} [millSeccond]
* @return {string}
*/
cck.msToTime(1446940800000); //'2015-11-08 08:00:00'
cck.msToTime(); //'2015-11-21 10:23:36' current time
/**
* to millisecond
* @param {int} year
* @param {int} month
* @param {int} day
* @param {int} [hour]
* @param {int} [min]
* @param {int} [sec]
* @param {int} [millisecond]
* @return {int}
*/
cck.timeToMS(2015,11,8,8); // 1446940800000
Check out 'test.cck.js'.
FAQs
A strict validator for string, integer, email, etc.
The npm package cck receives a total of 49 weekly downloads. As such, cck popularity was classified as not popular.
We found that cck demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.