Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jashkenas/underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Jul 24, 2013
2 parents 481798a + cbed8a7 commit 9d525bf
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
6 changes: 0 additions & 6 deletions .npmignore

This file was deleted.

1 change: 0 additions & 1 deletion index.js

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"scripts": {
"test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true"
},
"license" : "MIT"
"license" : "MIT",
"files" : ["underscore.js", "LICENSE"]
}
14 changes: 8 additions & 6 deletions test/speed.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

var numbers = [];
for (var i=0; i<1000; i++) numbers.push(i);
var objects = _.map(numbers, function(n){ return {num : n}; });
var objArray = _.map(numbers, function(n){ return {num : n}; });
var bigObj = {};
_.times(1000, function(n){ bigObj['key' + n] = n; });
var randomized = _.sortBy(numbers, function(){ return Math.random(); });
var deep = _.map(_.range(100), function() { return _.range(1000); });

Expand All @@ -25,15 +27,15 @@
});

JSLitmus.test('_.map()', function() {
return _.map(objects, function(obj){ return obj.num; });
return _.map(objArray, function(obj){ return obj.num; });
});

JSLitmus.test('jQuery.map()', function() {
return jQuery.map(objects, function(obj){ return obj.num; });
return jQuery.map(objArray, function(obj){ return obj.num; });
});

JSLitmus.test('_.pluck()', function() {
return _.pluck(objects, 'num');
return _.pluck(objArray, 'num');
});

JSLitmus.test('_.uniq()', function() {
Expand All @@ -53,11 +55,11 @@
});

JSLitmus.test('_.keys()', function() {
return _.keys(objects);
return _.keys(bigObj);
});

JSLitmus.test('_.values()', function() {
return _.values(objects);
return _.values(bigObj);
});

JSLitmus.test('_.intersection()', function() {
Expand Down
4 changes: 2 additions & 2 deletions underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Baseline setup
// --------------

// Establish the root object, `window` in the browser, or `global` on the server.
// Establish the root object, `window` in the browser, or `exports` on the server.
var root = this;

// Save the previous value of the `_` variable.
Expand Down Expand Up @@ -1087,7 +1087,7 @@

// Add your own custom functions to the Underscore object.
_.mixin = function(obj) {
each(_.functions(obj), function(name){
each(_.functions(obj), function(name) {
var func = _[name] = obj[name];
_.prototype[name] = function() {
var args = [this._wrapped];
Expand Down

0 comments on commit 9d525bf

Please sign in to comment.