prop-values

2.0.0 • Public • Published

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

  1. Bindable: obj (object): The object whose property values you want to get.
  2. Object argument:
    • Optional: own (boolean): If set to true, only the object’s “own” property values are returned. If omitted or if set to false, both owned and inherited property values are returned.
    • Optional: enumOnly (boolean): If set to true, only the values of properties defined with the enumerable flag will be returned.

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.

Package Sidebar

Install

npm i prop-values

Weekly Downloads

3

Version

2.0.0

License

MIT

Unpacked Size

3.45 kB

Total Files

4

Last publish

Collaborators

  • lamansky