https://github.com/dotcypress/sanitize-object
💊 Experimental JS Object cleanup
https://github.com/dotcypress/sanitize-object
Last synced: about 1 month ago
JSON representation
💊 Experimental JS Object cleanup
- Host: GitHub
- URL: https://github.com/dotcypress/sanitize-object
- Owner: dotcypress
- License: mit
- Created: 2017-02-26T03:43:24.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-28T20:15:26.000Z (about 8 years ago)
- Last Synced: 2025-03-25T05:35:07.203Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 💊 sanitize-object
[](https://www.npmjs.com/package/sanitize-object)
[](https://www.npmjs.com/package/sanitize-object)
[](https://travis-ci.org/dotcypress/sanitize-object)> Experimental JS Object cleanup
## Installation
```js
$ npm install sanitize-object
```## Example
```js
const { exclude, only } = require('sanitize-object')const sanitizeUser = exclude('password', 'id')
const result = sanitizeUser({id: 42, name: 'Rupert', password: 'qwerty'})
// result: { name: 'Rupert'}const sanitizeUser = only('name')
const result = sanitizeUser({id: 42, name: 'Rupert', password: 'qwerty'})
// result: { name: 'Rupert'}```