https://github.com/lamansky/prop-values
[Node.js] Iterates the values of all properties (owned and inherited) of an object.
https://github.com/lamansky/prop-values
Last synced: 2 months ago
JSON representation
[Node.js] Iterates the values of all properties (owned and inherited) of an object.
- Host: GitHub
- URL: https://github.com/lamansky/prop-values
- Owner: lamansky
- License: mit
- Created: 2018-04-13T09:04:08.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-23T14:28:11.000Z (about 8 years ago)
- Last Synced: 2025-10-01T20:59:47.583Z (9 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# prop-values
Returns an array of the values of all properties (owned and inherited) of an object.
## Installation
Requires [Node.js](https://nodejs.org/) 7.0.0 or above.
```bash
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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty)” 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
```javascript
const values = require('prop-values')
values({key: 'value'}, {own: true}) // ['value']
```
## Related
* [prop-entries](https://github.com/lamansky/prop-entries): Same as this module, except it returns key-value pairs.
* [prop-keys](https://github.com/lamansky/prop-keys): Same as this module, except it returns keys.
* [values-array](https://github.com/lamansky/values-array): Supports more than just Objects.