Skip to content

Commit

Permalink
unify the way to adding to array.fix Issue jashkenas#1025
Browse files Browse the repository at this point in the history
  • Loading branch information
stonelee committed Mar 18, 2013
1 parent 9d37502 commit ee24bbc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions underscore.js
Expand Up @@ -747,14 +747,14 @@
// Retrieve the values of an object's properties.
_.values = function(obj) {
var values = [];
for (var key in obj) if (_.has(obj, key)) values.push(obj[key]);
for (var key in obj) if (_.has(obj, key)) values[values.length] = obj[key];
return values;
};

// Convert an object into a list of `[key, value]` pairs.
_.pairs = function(obj) {
var pairs = [];
for (var key in obj) if (_.has(obj, key)) pairs.push([key, obj[key]]);
for (var key in obj) if (_.has(obj, key)) pairs[pairs.length] = [key, obj[key]];
return pairs;
};

Expand All @@ -770,7 +770,7 @@
_.functions = _.methods = function(obj) {
var names = [];
for (var key in obj) {
if (_.isFunction(obj[key])) names.push(key);
if (_.isFunction(obj[key])) names[names.length] = key;
}
return names.sort();
};
Expand Down

0 comments on commit ee24bbc

Please sign in to comment.