1.0.1 • Published 10 years ago

whitelist-obj-props v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

whitelist-obj-props

Apply a property whitelist to an object

Install

$ npm install --save whitelist-obj-props

Usage

import whitelistObjProps from 'whitelist-obj-propsj';
const propertyWhitelist = [ 'a', 'b' ];
let obj = { a: { b: 'c' }, b: { a: 'b', c: 'd' } };

whitelistObjProps(obj, propertyWhitelist);
//=> { a: { b: 'c' }, b: { a: 'b' } }

API

whitelistObjProps(input, whitelist)

input

Required
Type: object, array of objects

whitelist

Required
Type: array

License

MIT © Dominik Lessel