mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Reduce _.pluck.
Former-commit-id: 91db56f95d258070a0d25e4e4b74917e52b8cefe
This commit is contained in:
2
build.js
2
build.js
@@ -132,7 +132,7 @@
|
|||||||
'pairs': ['forOwn'],
|
'pairs': ['forOwn'],
|
||||||
'partial': ['isFunction', 'isObject'],
|
'partial': ['isFunction', 'isObject'],
|
||||||
'pick': ['forIn'],
|
'pick': ['forIn'],
|
||||||
'pluck': ['forEach'],
|
'pluck': ['map'],
|
||||||
'random': [],
|
'random': [],
|
||||||
'range': [],
|
'range': [],
|
||||||
'reduce': ['forEach'],
|
'reduce': ['forEach'],
|
||||||
|
|||||||
@@ -2346,11 +2346,7 @@
|
|||||||
* // => ['moe', 'larry', 'curly']
|
* // => ['moe', 'larry', 'curly']
|
||||||
*/
|
*/
|
||||||
function pluck(collection, property) {
|
function pluck(collection, property) {
|
||||||
var result = [];
|
return map(collection, property + '');
|
||||||
forEach(collection, function(value) {
|
|
||||||
result.push(value[property]);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user