🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

pluck-util

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pluck-util

Extract a list of property values from a collection.

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
7
-70.83%
Maintainers
1
Weekly downloads
 
Created
Source

pluck-util Build Status

Extract a list of property values from a collection.

A convenient version of what is perhaps the most common use-case for map.

Inspired by _.pluck. 😄

Install

Install with npm

$ npm install pluck-util

Or unpkg

<script src="https://unpkg.com/pluck-util@1.0.2/umd/index.js" />

Check out the unit tests on CodePen.

Usage

const pluck = require('pluck-util');

const stooges = [{name: 'moe', age: 40}, {name: 'larry', age: 50}, {name: 'curly', age: 60}];

pluck(stooges, 'name');
//=> ['moe', 'larry', 'curly']

pluck(stooges, 'age');
//=> [40, 50, 60]
Like us a lot? Help others know why you like us! Review this package on pkgreview.devReview us on pkgreview.dev

API

pluck(collection, propertyName)

collection

Type: array
Default: none

The array to iterate over.

propertyName

Type: string
Default: none

The property name to extract.

License

MIT

Keywords

array

FAQs

Package last updated on 24 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts