get-object-key
v1.0.2
Published
Access object keys by index, like they were an array.
Downloads
1
Readme
get-object-key
Access object keys by index, like they were an array.
Get keys from an object by using a positive or negative index: getObjectKey(obj, -1)
. Your infamous one line micro package.
Install
$ npm install get-object-key --save
Usage
const getObjectKey = require('get-object-key');
const flags = {
dev: true,
prod: false,
}
let flag = null;
flag = getObjectKey(flags, -1);
// => 'prod'
flag = getObjectKey(flags, 0);
// => 'dev'
License
MIT