From 7d6fcc75daaec2bb2346ced3f75c83c537b1debd Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 30 Aug 2015 03:39:07 -0700 Subject: [PATCH] Use `arrayReduce` in `basePick`. --- lodash.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lodash.js b/lodash.js index ca7c770c5..f7994372d 100644 --- a/lodash.js +++ b/lodash.js @@ -2315,18 +2315,12 @@ */ function basePick(object, props) { object = Object(object); - - var index = -1, - length = props.length, - result = {}; - - while (++index < length) { - var key = props[index]; + return arrayReduce(props, function(result, key) { if (key in object) { result[key] = object[key]; } - } - return result; + return result; + }, {}); } /**