Skip to content

Commit

Permalink
move obj = Object(obj) inside else block in _.pick
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra committed Jun 21, 2014
1 parent dfbc330 commit 0ae8dc9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,6 @@
_.pick = function(obj, iterator, context) {
var result = {}, key;
if (obj == null) return result;
obj = Object(obj);
if (_.isFunction(iterator)) {
iterator = createCallback(iterator, context);
for (key in obj) {
Expand All @@ -904,6 +903,7 @@
}
} else {
var keys = concat.apply([], slice.call(arguments, 1));
obj = Object(obj);
for (var i = 0, length = keys.length; i < length; i++) {
key = keys[i];
if (key in obj) result[key] = obj[key];
Expand Down

0 comments on commit 0ae8dc9

Please sign in to comment.