1.0.6 • Published 2 years ago
obj-sanitize v1.0.6
obj-sanitize
This NPM packet Manager is used to Sanitize data i.e Whether data in the the Key:value pair is Present or not. This package is useful in the backend whether data received as the key:value pair contains the all field if the key:value pair value is present the status will be shown as True. if key:value pair value is found missing it status will be shown as False.
Installation
npm i obj-sanitize --save
Usage
objValidate(arr)
The usage of this module is very straightforward, as you can see in the example below.
var objsanitize = require('obj-sanitize');
// var arr = [
// { name:'saran1', age:'', contact:'125', address:'wewq', edu:'rew', role:'rew' },
// { name:'saran2', age:'28', contact:'', address:'1212', edu:'rew', role:'rew' },
// { name:'saran3', age:'28', contact:'454', address:'wqe', edu:'rew', role:'rew' },
// { name:'saran4', age:'27', contact:'sd', address:'sd', edu:'rew', role:'rew' },
// ]
var output = fun.objValidate(arr)
console.log(output);
// {
// status: false,
// missFields: [ { row: 0, field: 'age' }, { row: 1, field: 'contact' } ]
// }
License
ISC