White List Object
A small module that takes in an object and returns a new object only containing white listed keys.
Args
- object - the object you want to reduce to only whitelisted keys.
- whitelist - an array containing the keys you want the new object to maintain
- shallow - optional true false value. if true, will only look for whitelisted keys in top level object. defaults to false.
Install
npm i whitelist-object --save
Example
var whiteListObject = ; var myObject = cool: "guy" conor: "hastings" wow: "so cool" but: is: "he" no: "he isn't";var whiteListedObject = ;//returns {cool: "guy", but: {is: "he"}};var shallowWhiteListObject = ;//returns {cool: "guy", but: {is: "he", no: "he isn't"}};