key-as-array

2.0.0 • Public • Published

key-as-array Build Status

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

Package Sidebar

Install

npm i key-as-array

Weekly Downloads

134

Version

2.0.0

License

MIT

Last publish

Collaborators

  • lasalefamine