sanee
v1.0.0
Published
A sanitizer for (nested) objects with a simple API.
Downloads
10
Readme
sanee
A sanitizer for (nested) objects with a simple API. For validating objects, check out valee.
Usage
Installation
$ npm install sanee
Example
var sanee = require('sanee');
// create sanitize-function
var sanitize = sanee({
user: {
email: sanee.normalizeEmail({ lowercase: true }),
name: sanee.trim()
}
});
// sanitize input
var sanitizedInput = sanitize({
user: {
email: '[email protected]',
name: ' Max '
}
});
// print sanitized input
console.log(sanitizedInput);
Output:
{
user: {
email: '[email protected]',
name: 'Max'
}
}
Sanitizers
All sanitizers of sanee currently map to the sanitizers of validator.js.