@edgeros/only
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

only

Return whitelisted properties of an object.

Installation

$ npm install @edgeros/only

API

An array or space-delimited string may be given:

var obj = {
  name: 'tobi',
  last: 'holowaychuk',
  email: 'tobi@learnboost.com',
  _id: '12345'
};

var user = only(obj, ['name', 'last', 'email']);

yields:

{
  name: 'tobi',
  last: 'holowaychuk',
  email: 'tobi@learnboost.com'
}

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @edgeros/only

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

1.56 kB

Total Files

4

Last publish

Collaborators

  • clarkttfu
  • fu-starslights
  • epmbot
  • xieyuanbin
  • chengyonbin