Skip to content

ahadb/obj-values

Repository files navigation

obj-values

Retrieve the values of an enumerable object.

Overview

Use this node module when you need to retrieve values from an enumerable object - obj-values outputs an array, has an optional reverse param.

Installing

Install with npm

npm i obj-values --save-dev

Usage

Simply require the obj-values module. The export function can be used in any module you desire:

const objValues = require('obj-values');

var myObj = {
  a: 10,
  b: 200,
  c: 3000,
  d: "fourty thousand"
};

objValues(myObj);
//==> [10, 200, 3000, 'fourty thousand']

objValues(myObj, {reverse: true});
//==> ['fourty thousand', 3000, 200, 10]

objValues({foo: "bar", baz: "quux", fooBar: "norf"});
//==> ['bar', 'quux', 'norf']

Tests

This module uses gulp for eslint, mocha, and code coverage tools.

Run gulp init

 #objValues
    ✓ should return an array
    ✓ expect result to be ok
    ✓ expect result to be at least 3
    ✓ should return the appropriate members
    ✓ last property should be a three
    ✓ last property should be a three, a string
    ✓ should return the appropriate members in reverse order

Related Modules

##Contributing

Feel free to file an issue or bugs

About

Retrieve the values of an enumerable object

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published