objectvalues
To get all the values of all the keys of an object. It provides options to fetch values of nested keys as well.
Installation
Install with npm:
$ npm install objectvalues --save
Usage
var OBJECT_VALUES = ; var object = 'California' : 'CA' 'Texas' : 'TX' 'NEW YORK' : 'NY' ; OBJECT_VALUES;//=> ['CA', 'TX', 'NY'] var days = 'SUNDAY' : 'First' 'MONDAY' : 'Second' 'TUESDAY' : 'Third' 'WEDNESDAY' : 3; OBJECT_VALUES;//=> ['First', 'Second', 'Third', 3]
Clone the repo
$ git clone https://github.com/luthraG/objectvalues.git
API
values(obj, [options])
This API takes two parameters:
- Object whose values to be fetched and
- options object. This argument is optional
Options
Various options supported by this API are :
- deep - To specify if values of nested keys should also be fethced. Default is false.
Example with options
var OBJECT_VALUES = ; var days = 'SUNDAY' : 'First' 'MONDAY' : 'Second' 'TUESDAY' : 'Third' 'WEDNESDAY' : 3 'WEEK_END' : 'SUNDAY' : 'CODE' : 'ABBR' : 'SAT' ; OBJECT_VALUES;//=> [ 'First', 'Second', 'Third', 3, 'SAT' ]
Related projects
You might also be interested in these projects:
- uppercase-values: Convert the values of all the keys of an object into uppercase. | homepage
- lowercase-values: Convert the values of all the keys of an object into lowercase. | homepage
- object-lowerkeys: Convert the keys of an object into lowercase. | homepage
- object-upperkeys: Convert the keys of an object into uppercase. | homepage
Author
Gaurav Luthra
License
MIT © Gaurav Luthra