sanitize-object
v0.1.0
Published
JS Object cleanup
Downloads
437
Readme
💊 sanitize-object
Experimental JS Object cleanup
Installation
$ npm install sanitize-object
Example
const { exclude, only } = require('sanitize-object/exclude')
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'}