sanitize-object

Take only the fields you need from a JS object

Returns a new object with desired content from another source

$ npm install sanitize-object
sanitize = require('sanitize-object')
 
input = {
  foo: 123,
  bar: 456,
  qux: 789
}
 
sanitize('foo', 'qux')(input)
// => { foo: 123, qux: 789 }