
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
mastercheck
Advanced tools
Consistency check of the master data.
npm install mastercheck
var mastercheck = require('mastercheck');
var format = {
CollectionA: {
_id: new mastercheck.String(),
num: new mastercheck.Number(),
obj: {
bool: new mastercheck.Boolean(),
},
list: [
{
num: new mastercheck.Number()
}
],
arr: [
new mastercheck.Number()
],
map: new mastercheck.Map(null, {
name: new mastercheck.String()
})
},
CollectionB: {}
}
mastercheck.setup(format);
var masterData = {
CollectionA: [
{ _id: 'A1', num: 0, obj: { bool: true }, list: [ { num: 1 }, { num: 2 } ], arr: [ 1, 2 ], map: { test1: { name: 'test1' }, test2: { name: 'test2' } } },
{ _id: 'A2', num: 0, obj: { bool: 1 }, list: [ { num: 1 }, { num: 2 } ], arr: [ 1, 2 ], map: { test1: { name: 'test1' }, test2: { name: 'test2' } } }
],
CollectionB: [
]
};
mastercheck.check('CollectionA', masterData.CollectionA, function(err) {
// The return err in { collectionName: 'CollectionA', _id: 'A2', key: 'obj.bool', value: 1 } when it was inconsistent if
});
mastercheck.checkAll(masterData, function(err) {
// The return err in { collectionName: 'CollectionA', _id: 'A2', key: 'obj.bool', value: 1 } when it was inconsistent if
});
// For numeric values of 0-10.
new mastercheck.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.
});
// For a string of 0-20 characters to match /^apple_/.
new mastercheck.String({
required: true, // Existence check. Default do not check.
minLength: 0, // Minimum number of characters check. Default do not check.
maxLength: 20, // Maximum number of characters check. Default do not check.
match: /^apple_/ // String match check. Value to use for the String#match. Default do not check.
});
// For a string of any in ['A', 'B', 'C'].
new mastercheck.String({
required: true, // Existence check. Default do not check.
select: [ 'A', 'B', 'C' ] // String match check. Default do not check.
});
// For a boolean.
new mastercheck.Number({
required: true // Existence check. Default do not check.
});
// For a object.
new mastercheck.Object({
required: true // Existance check. Default do not check.
}, {
bool: new mastercheck.Boolean(),
num: new mastercheck.Number()
});
// For a object.
new mastercheck.Map({
maxLength: 20, // Maximum number of characters check. Default do not check.
match: /^apple_/ // String match check. Value to use for the String#match. Default do not check.
}, {
bool: new mastercheck.Boolean(),
num: new mastercheck.Number()
});
Run npm test
and npm run-script jshint
FAQs
mastercheck
The npm package mastercheck receives a total of 0 weekly downloads. As such, mastercheck popularity was classified as not popular.
We found that mastercheck 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.