https://github.com/peakmoney/whitelister
Simple, basic filtering and validation tool for Node.js.
https://github.com/peakmoney/whitelister
javascript nodejs parameters utilities validation validation-library whitelist whitelist-validation whitelisting whitelisting-filter
Last synced: about 1 month ago
JSON representation
Simple, basic filtering and validation tool for Node.js.
- Host: GitHub
- URL: https://github.com/peakmoney/whitelister
- Owner: peakmoney
- License: mit
- Created: 2017-08-18T18:30:01.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-01T22:12:10.000Z (over 7 years ago)
- Last Synced: 2025-02-14T05:16:29.826Z (4 months ago)
- Topics: javascript, nodejs, parameters, utilities, validation, validation-library, whitelist, whitelist-validation, whitelisting, whitelisting-filter
- Language: JavaScript
- Homepage: https://spireteam.github.io/whitelister/
- Size: 298 KB
- Stars: 47
- Watchers: 6
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Whitelister
Simple, **dependency-free** filtering and validation tool for Node.js.
[](https://travis-ci.org/SpireTeam/whitelister)
## Quick Start
Using npm:
`npm i --save whitelister`
In Node.js
```js
const whitelister = require('whitelister');const rules = {
q: 'string',
page: { type: 'integer', min: 1, default: 1 },
per_page: { type: 'integer', min: 1, max: 100, default: 20 },
};const params = { q: 'hello' };
return whitelister(rules, params);
// => { page: 1, per_page: 20, q: 'hello' };
```## Documentation
You can find the full documentation on the website: [https://spireteam.github.io/whitelister/](https://spireteam.github.io/whitelister/)
## License
MIT
## Changelog
### v0.0.5
#### Oct. 25, 2017
* Ignore non-required properties with `undefined` values
* Treat external errors differently than internal errors### v0.0.4
#### Oct. 16, 2017
* Ensure that `type` is treated like other `attributes`