mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Use arrayReduce in basePick.
This commit is contained in:
12
lodash.js
12
lodash.js
@@ -2315,18 +2315,12 @@
|
|||||||
*/
|
*/
|
||||||
function basePick(object, props) {
|
function basePick(object, props) {
|
||||||
object = Object(object);
|
object = Object(object);
|
||||||
|
return arrayReduce(props, function(result, key) {
|
||||||
var index = -1,
|
|
||||||
length = props.length,
|
|
||||||
result = {};
|
|
||||||
|
|
||||||
while (++index < length) {
|
|
||||||
var key = props[index];
|
|
||||||
if (key in object) {
|
if (key in object) {
|
||||||
result[key] = object[key];
|
result[key] = object[key];
|
||||||
}
|
}
|
||||||
}
|
return result;
|
||||||
return result;
|
}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user