mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Use baseProperty instead of _.property in more places.
This commit is contained in:
@@ -6234,7 +6234,7 @@
|
|||||||
* // => [36, 40] (iteration order is not guaranteed)
|
* // => [36, 40] (iteration order is not guaranteed)
|
||||||
*/
|
*/
|
||||||
function pluck(collection, key) {
|
function pluck(collection, key) {
|
||||||
return map(collection, property(key));
|
return map(collection, baseProperty(key + ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10896,10 +10896,10 @@
|
|||||||
// Add `LazyWrapper` methods for `_.pluck` and `_.where`.
|
// Add `LazyWrapper` methods for `_.pluck` and `_.where`.
|
||||||
arrayEach(['pluck', 'where'], function(methodName, index) {
|
arrayEach(['pluck', 'where'], function(methodName, index) {
|
||||||
var operationName = index ? 'filter' : 'map',
|
var operationName = index ? 'filter' : 'map',
|
||||||
createCallback = index ? baseMatches : property;
|
createCallback = index ? baseMatches : baseProperty;
|
||||||
|
|
||||||
LazyWrapper.prototype[methodName] = function(value) {
|
LazyWrapper.prototype[methodName] = function(value) {
|
||||||
return this[operationName](createCallback(value));
|
return this[operationName](createCallback(index ? value : (value + '')));
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user