Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maximilianschmitt/sanee
A sanitizer for (nested) objects with a simple API.
https://github.com/maximilianschmitt/sanee
Last synced: about 1 month ago
JSON representation
A sanitizer for (nested) objects with a simple API.
- Host: GitHub
- URL: https://github.com/maximilianschmitt/sanee
- Owner: maximilianschmitt
- License: mit
- Created: 2014-12-11T14:52:29.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-13T16:27:23.000Z (over 8 years ago)
- Last Synced: 2024-11-20T12:59:16.525Z (about 2 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sanee
[![Travis Build](http://img.shields.io/travis/maximilianschmitt/sanee.svg?style=flat)](https://travis-ci.org/maximilianschmitt/sanee) [![Coverage Status](https://coveralls.io/repos/maximilianschmitt/sanee/badge.svg)](https://coveralls.io/r/maximilianschmitt/sanee)
> A sanitizer for (nested) objects with a simple API. For validating objects, check out [valee](https://github.com/maximilianschmitt/valee).
## Usage
### Installation
```
$ npm install sanee
```### Example
``` js
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:
```js
{
user: {
email: '[email protected]',
name: 'Max'
}
}
```## Sanitizers
All sanitizers of sanee currently map to the [sanitizers of validator.js](https://github.com/chriso/validator.js#sanitizers).