Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mastercheck

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mastercheck - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

4

lib/mastercheck.js

@@ -41,2 +41,3 @@ /**

* max: 10, // Maximum value check.
* integer: true, // Integer check.
* select: [ 1, 3, 7 ], // Select match check. Default do not check.

@@ -63,2 +64,5 @@ * };

}
if (this.option.integer && data % 1 !== 0) {
return data + ' should be integer';
}
if (this.option.hasOwnProperty('select') && !~this.option.select.indexOf(data)) {

@@ -65,0 +69,0 @@ return data + ' should match ' + this.option.select.join(' or ');

2

package.json
{
"name": "mastercheck",
"version": "0.2.5",
"version": "0.2.6",
"description": "mastercheck",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -62,7 +62,8 @@ MasterCheck

```
// For a number values of 0-10.
// For a integer number values of 0-10.
mastercheck.format('Number', {
required: true, // Existence check. Default do not check.
min: 0, // Minimum value check. Default do not check.
max: 10 // Maximum value check. Default do not check.
min: 0, // Minimum value check. Default do not check.
max: 10, // Maximum value check. Default do not check.
integer: true // Integer check. Default do not check.
});

@@ -69,0 +70,0 @@

@@ -10,3 +10,3 @@ var should = require('should');

_id: masterCheck.format('String', { required: true }),
num: masterCheck.format('Number', { min: 0, max: 100 }),
num: masterCheck.format('Number', { min: 0, max: 100, integer: true }),
obj: {

@@ -114,2 +114,23 @@ code: masterCheck.format('String', { minLength: 1, maxLength: 10 }),

});
it('Integer check test.', function(done) {
var dataList = [
{
_id: 'test1',
num: 10,
arr: [ 1, 2 ]
},
{
_id: 'test2',
num: 10.1,
arr: [ 3, 4 ]
}
];
masterCheck.check('A', dataList, function(err, result) {
should.not.exist(err);
should.exist(result);
result.should.eql({ test2: [ { key: 'num', value: 10.1, message: '10.1 should be integer' } ] });
done();
});
});
});

@@ -116,0 +137,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc