mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Bump to v3.7.0.
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import baseProperty from '../internal/baseProperty';
|
||||
import map from './map';
|
||||
import property from '../utility/property';
|
||||
|
||||
/**
|
||||
* Gets the value of `key` from all elements in `collection`.
|
||||
* Gets the property value of `path` from all elements in `collection`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Collection
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
* @param {string} key The key of the property to pluck.
|
||||
* @param {Array|string} path The path of the property to pluck.
|
||||
* @returns {Array} Returns the property values.
|
||||
* @example
|
||||
*
|
||||
@@ -24,8 +24,8 @@ import map from './map';
|
||||
* _.pluck(userIndex, 'age');
|
||||
* // => [36, 40] (iteration order is not guaranteed)
|
||||
*/
|
||||
function pluck(collection, key) {
|
||||
return map(collection, baseProperty(key));
|
||||
function pluck(collection, path) {
|
||||
return map(collection, property(path));
|
||||
}
|
||||
|
||||
export default pluck;
|
||||
|
||||
Reference in New Issue
Block a user