prop-values
v2.0.0
Published
Returns an array of the values of all properties (owned and inherited) of an object.
Downloads
12
Maintainers
Readme
prop-values
Returns an array of the values of all properties (owned and inherited) of an object.
Installation
Requires Node.js 7.0.0 or above.
npm i prop-values
API
The module exports a single function.
Parameters
- Bindable:
obj
(object): The object whose property values you want to get. - Object argument:
- Optional:
own
(boolean): If set totrue
, only the object’s “own” property values are returned. If omitted or if set tofalse
, both owned and inherited property values are returned. - Optional:
enumOnly
(boolean): If set totrue
, only the values of properties defined with theenumerable
flag will be returned.
- Optional:
Return Value
An array of values of object properties.
Example
const values = require('prop-values')
values({key: 'value'}, {own: true}) // ['value']
Related
- prop-entries: Same as this module, except it returns key-value pairs.
- prop-keys: Same as this module, except it returns keys.
- values-array: Supports more than just Objects.