From 3ccca41e169939c0574704da754243953c6e54f2 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 14 Jul 2013 11:39:17 -0700 Subject: [PATCH 1/5] whitespace before function body --- underscore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/underscore.js b/underscore.js index 05592c3c4..5fd975b85 100644 --- a/underscore.js +++ b/underscore.js @@ -1084,7 +1084,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]; From c7e9907c67b67da7845e39b60975b7ccbce5a500 Mon Sep 17 00:00:00 2001 From: Peter Rust Date: Fri, 19 Jul 2013 07:08:00 -0700 Subject: [PATCH 2/5] Corrected comment about root being global on the server The corresponding comment in the Backbone source was corrected on this point about 9 months ago (see: https://github.com/jashkenas/backbone/issues/1751) --- underscore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/underscore.js b/underscore.js index 5fd975b85..876202023 100644 --- a/underscore.js +++ b/underscore.js @@ -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. From 09a2a3366be1c81acb98c36cce0e0da84b96888a Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Sat, 20 Jul 2013 16:11:32 -0500 Subject: [PATCH 3/5] delete unused index.js this hasn't been needed since d62906672b62c0e1c7817d74d3f1971cc3f132bc --- index.js | 1 - 1 file changed, 1 deletion(-) delete mode 100644 index.js diff --git a/index.js b/index.js deleted file mode 100644 index 2cf0ca5b0..000000000 --- a/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./underscore'); From 4dd53a0681e50cad11f91f7513a479f0dcc713d8 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 20 Jul 2013 22:55:22 +0200 Subject: [PATCH 4/5] Explicitly set the contents of the npm package --- .npmignore | 6 ------ package.json | 3 ++- 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 .npmignore diff --git a/.npmignore b/.npmignore deleted file mode 100644 index cfff910a2..000000000 --- a/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -test/ -Rakefile -docs/ -raw/ -index.html -underscore-min.js diff --git a/package.json b/package.json index b0f3cf487..51d579d3b 100644 --- a/package.json +++ b/package.json @@ -13,5 +13,6 @@ "scripts": { "test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true" }, - "license" : "MIT" + "license" : "MIT", + "files" : ["underscore.js", "LICENSE"] } From 34731862ab0ffcf814ce6187aac5bd867f9ff07a Mon Sep 17 00:00:00 2001 From: liuyl Date: Tue, 23 Jul 2013 15:15:27 +0800 Subject: [PATCH 5/5] add big objects --- test/speed.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/speed.js b/test/speed.js index 479cac61a..90ede5291 100644 --- a/test/speed.js +++ b/test/speed.js @@ -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); }); @@ -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() { @@ -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() {