get-js-object-key-value
v1.0.1
Published
Return the key and value of the given JS Object
Downloads
10
Maintainers
Readme
get-js-object-key-value
Return the key and value of the given JS Object
API
var getKeyValue = require('get-js-object-key-value')
getKeyValue(object:JSObject)
the JSObject can be an object with one or more properties
Return
- one property should return a js object with {key, value}
- more than one property should return an array with [{key, value}, {key, value}]
- undefined in case to pass an empty JS Object
Usage
var getKeyValue = require('get-js-object-key-value');
var scripts = require('./package.json').scripts;
var arr = getKeyValue(scripts);
[
{ key: 'test', value: 'lab -v -c test.js' },
{ key: 'jshint', value: 'jshint -c .jshintrc *.js' },
{ key: 'code-style', value: 'jscs -p google *.js' },
{ key: 'check-coverage',
value: 'lab -t 100 -r html -o coverage.html test.js' },
{ key: 'open-coverage', value: 'open coverage.html' }
]
Development
this projet has been set up with a precommit that forces you to follow a code style, no jshint issues and 100% of code coverage before commit
to run test
npm test
to run jshint
npm run jshint
to run code style
npm run code-style
to run check code coverage
npm run check-coverage
to open the code coverage report
npm run open-coverage