params-integrity
v0.2.5
Published
Lite param checker with simplicity and promises in mind. Easilly checks mandatory fields / keys / values of an object. Aimed a ease Rest API parameter checking.
Downloads
3
Maintainers
Readme
params-integrity
Performs basic presence-checking of a list of keys from an object.
Install via npm
npm install params-integrity
Basic usage
var paramsIntegrity = require("params-integrity");
// example object to be checked
var objectToCheck = {
parameter1: "lorem",
parameter2: "ipsum",
parameter3: "sit"
};
paramsIntegrity.checkRequiredParams([
'parameter1',
'parameter2',
'parameter3',
], objectToCheck)
.then(function(validatedParams){
// do what you want with the validatedParams
})
.catch(function(error){
// perform error handling here
});