2.0.0 • Published 8 years ago
key-as-array v2.0.0
key-as-array
Get an array of a specific key from an array of object
Install
$ yarn add key-as-array
Usage
const keyAsArray = require('key-as-array');
const arr = [{link: 'a link', useless: 'prop'}, {link: 'a second link', useless: 'prop2'}]
keyAsArray(arr, 'link');
//=> ['a link', 'a second link']
API
keyAsArray(input, keyName)
return
Type: array
|| undefined
input
Type: array
Array of similar objects.
keyName
Type: string
Name of the key you want to get.
License
MIT © LasaleFamine