Update vendor/underscore to v1.5.1 and update copyrights and tested environments.

Former-commit-id: 3bdfb1de97d08d05199f5f97c9c3145d7068e7fd
This commit is contained in:
John-David Dalton
2013-07-09 23:57:54 -07:00
parent 9d3932bd82
commit 0ea9362d06
16 changed files with 82 additions and 49 deletions

View File

@@ -1,6 +1,6 @@
Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
Based on Underscore.js 1.4.3, copyright 2009-2013 Jeremy Ashkenas,
DocumentCloud Inc. <http://underscorejs.org/>
Based on Underscore.js 1.5.1, copyright 2009-2013 Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -80,7 +80,7 @@ For more information check out these articles, screencasts, and other videos ove
## Support
Lo-Dash has been tested in at least Chrome 5~27, Firefox 2~22, IE 6-10, Opera 9.25~15, Safari 3-6, Node.js 0.4.8-0.10.12*, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5.
Lo-Dash has been tested in at least Chrome 5~28, Firefox 2~22, IE 6-10, Opera 9.25~15, Safari 3-6, Node.js 0.4.8-0.10.13*, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5.
\* Node.js 0.10.8-0.10.11 [have](https://github.com/joyent/node/issues/5622) [bugs](https://github.com/joyent/node/issues/5688) that prevent the `lodash` command-line utility from creating minified builds.

View File

@@ -502,7 +502,7 @@
// restrict lines to 500 characters for consistency with the Closure Compiler
var stream = uglifyJS.OutputStream({
'ascii_only': !this.isTemplate,
'comments': /@cc_on|@license|@preserve/i,
'comments': /^!|@cc_on|@license|@preserve/i,
'max_line_len': 500,
});

View File

@@ -10,8 +10,7 @@
var licenseTemplate = [
'/**',
' * @license',
' * Lo-Dash <%= VERSION %> lodash.com/license',
' * Underscore.js 1.4.4 underscorejs.org/LICENSE',
' * Lo-Dash <%= VERSION %> lodash.com/license | Underscore.js 1.5.1 underscorejs.org/LICENSE',
' */'
].join('\n');

View File

@@ -3,8 +3,8 @@
* Lo-Dash 1.3.1 (Custom Build) <http://lodash.com/>
* Build: `lodash -o ./dist/lodash.compat.js`
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.4.4 <http://underscorejs.org/>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
* Based on Underscore.js 1.5.1 <http://underscorejs.org/>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <http://lodash.com/license>
*/
;(function(window) {

View File

@@ -1,8 +1,7 @@
/**
* @license
* Lo-Dash 1.3.1 (Custom Build) lodash.com/license
* Lo-Dash 1.3.1 (Custom Build) lodash.com/license | Underscore.js 1.5.1 underscorejs.org/LICENSE
* Build: `lodash -o ./dist/lodash.compat.js`
* Underscore.js 1.4.4 underscorejs.org/LICENSE
*/
;!function(n){function t(n,t,r){r=(r||0)-1;for(var e=n.length;++r<e;)if(n[r]===t)return r;return-1}function r(n,r){var e=typeof r;if(n=n.k,"boolean"==e||r==d)return n[r];"number"!=e&&"string"!=e&&(e="object");var u="number"==e?r:O+r;return n=n[e]||(n[e]={}),"object"==e?n[u]&&-1<t(n[u],r)?0:-1:n[u]?0:-1}function e(n){var t=this.k,r=typeof n;if("boolean"==r||n==d)t[n]=m;else{"number"!=r&&"string"!=r&&(r="object");var e="number"==r?n:O+n,t=t[r]||(t[r]={});"object"==r?(t[e]||(t[e]=[])).push(n):t[e]=m}}function u(n){return n.charCodeAt(0)
}function a(n,t){var r=n.m,e=t.m;if(n=n.l,t=t.l,n!==t){if(n>t||typeof n=="undefined")return 1;if(n<t||typeof t=="undefined")return-1}return r<e?-1:1}function o(n){var t=-1,r=n.length,u=n[0],a=n[r-1];if(u&&typeof u=="object"&&a&&typeof a=="object")return b;for(u=c(),u["false"]=u["null"]=u["true"]=u.undefined=b,a=c(),a.b=n,a.k=u,a.push=e;++t<r;)a.push(n[t]);return a}function i(n){return"\\"+nt[n]}function l(){return _.pop()||[]}function c(){return j.pop()||{a:"",b:d,c:"",k:d,l:d,"false":b,d:"",m:0,e:"",leading:b,f:"",maxWait:0,"null":b,number:d,object:d,push:d,g:d,string:d,h:"",trailing:b,"true":b,undefined:b,i:b,j:b,n:d}

4
dist/lodash.js vendored
View File

@@ -3,8 +3,8 @@
* Lo-Dash 1.3.1 (Custom Build) <http://lodash.com/>
* Build: `lodash modern -o ./dist/lodash.js`
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.4.4 <http://underscorejs.org/>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
* Based on Underscore.js 1.5.1 <http://underscorejs.org/>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <http://lodash.com/license>
*/
;(function(window) {

3
dist/lodash.min.js vendored
View File

@@ -1,8 +1,7 @@
/**
* @license
* Lo-Dash 1.3.1 (Custom Build) lodash.com/license
* Lo-Dash 1.3.1 (Custom Build) lodash.com/license | Underscore.js 1.5.1 underscorejs.org/LICENSE
* Build: `lodash modern -o ./dist/lodash.js`
* Underscore.js 1.4.4 underscorejs.org/LICENSE
*/
;!function(n){function t(n,t,e){e=(e||0)-1;for(var r=n.length;++e<r;)if(n[e]===t)return e;return-1}function e(n,e){var r=typeof e;if(n=n.k,"boolean"==r||e==h)return n[e];"number"!=r&&"string"!=r&&(r="object");var u="number"==r?e:w+e;return n=n[r]||(n[r]={}),"object"==r?n[u]&&-1<t(n[u],e)?0:-1:n[u]?0:-1}function r(n){var t=this.k,e=typeof n;if("boolean"==e||n==h)t[n]=y;else{"number"!=e&&"string"!=e&&(e="object");var r="number"==e?n:w+n,t=t[e]||(t[e]={});"object"==e?(t[r]||(t[r]=[])).push(n):t[r]=y}}function u(n){return n.charCodeAt(0)
}function a(n,t){var e=n.m,r=t.m;if(n=n.l,t=t.l,n!==t){if(n>t||typeof n=="undefined")return 1;if(n<t||typeof t=="undefined")return-1}return e<r?-1:1}function o(n){var t=-1,e=n.length,u=n[0],a=n[e-1];if(u&&typeof u=="object"&&a&&typeof a=="object")return b;for(u=c(),u["false"]=u["null"]=u["true"]=u.undefined=b,a=c(),a.b=n,a.k=u,a.push=r;++t<e;)a.push(n[t]);return a}function i(n){return"\\"+L[n]}function f(){return m.pop()||[]}function c(){return d.pop()||{b:h,k:h,l:h,"false":b,m:0,leading:b,maxWait:0,"null":b,number:h,object:h,push:h,string:h,trailing:b,"true":b,undefined:b,n:h}

View File

@@ -3,8 +3,8 @@
* Lo-Dash 1.3.1 (Custom Build) <http://lodash.com/>
* Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js`
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.4.4 <http://underscorejs.org/>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
* Based on Underscore.js 1.5.1 <http://underscorejs.org/>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <http://lodash.com/license>
*/
;(function(window) {

View File

@@ -1,8 +1,7 @@
/**
* @license
* Lo-Dash 1.3.1 (Custom Build) lodash.com/license
* Lo-Dash 1.3.1 (Custom Build) lodash.com/license | Underscore.js 1.5.1 underscorejs.org/LICENSE
* Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js`
* Underscore.js 1.4.4 underscorejs.org/LICENSE
*/
;!function(n){function t(n,t,r){r=(r||0)-1;for(var e=n.length;++r<e;)if(n[r]===t)return r;return-1}function r(n,t){var r=n.m,e=t.m;if(n=n.l,t=t.l,n!==t){if(n>t||typeof n=="undefined")return 1;if(n<t||typeof t=="undefined")return-1}return r<e?-1:1}function e(n){return"\\"+lt[n]}function u(){}function i(n){return n instanceof i?n:new o(n)}function o(n){this.__wrapped__=n}function a(n,t,r,e){function u(){var e=arguments,c=o?this:t;return i||(n=t[a]),r.length&&(e=e.length?(e=Rt.call(e),l?e.concat(r):r.concat(e)):r),this instanceof u?(c=f(n.prototype),e=n.apply(c,e),b(e)?e:c):n.apply(c,e)
}var i=d(n),o=!r,a=t;if(o){var l=e;r=t}else if(!i){if(!e)throw new TypeError;t=n}return u}function f(n){return b(n)?xt(n):{}}function l(n){return Mt[n]}function c(){var n=(n=i.indexOf)===I?t:n;return n}function p(n){return $t[n]}function s(n){return n&&typeof n=="object"?jt.call(n)==nt:!1}function v(n){if(!n)return n;for(var t=1,r=arguments.length;t<r;t++){var e=arguments[t];if(e)for(var u in e)n[u]=e[u]}return n}function g(n){if(!n)return n;for(var t=1,r=arguments.length;t<r;t++){var e=arguments[t];

View File

@@ -2,8 +2,8 @@
* @license
* Lo-Dash 1.3.1 <http://lodash.com/>
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.4.4 <http://underscorejs.org/>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
* Based on Underscore.js 1.5.1 <http://underscorejs.org/>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <http://lodash.com/license>
*/
;(function(window) {

View File

@@ -1,4 +1,5 @@
Copyright (c) 2009-2013 Jeremy Ashkenas, DocumentCloud
Copyright (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative
Reporters & Editors
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation

View File

@@ -134,19 +134,17 @@ $(document).ready(function() {
var names = ['moe', 'larry', 'curly'], ages = [30, 40, 50], leaders = [true];
var stooges = _.zip(names, ages, leaders);
equal(String(stooges), 'moe,30,true,larry,40,,curly,50,', 'zipped together arrays of different lengths');
});
test('unzip', function() {
var stoogesUnzipped = _.unzip(['moe',30, 'stooge 1'],['larry',40, 'stooge 2'],['curly',50, 'stooge 3']);
deepEqual(stoogesUnzipped, [['moe','larry','curly'],[30,40,50], ['stooge 1', 'stooge 2', 'stooge 3']], 'unzipped pairs');
stooges = _.zip(['moe',30, 'stooge 1'],['larry',40, 'stooge 2'],['curly',50, 'stooge 3']);
deepEqual(stooges, [['moe','larry','curly'],[30,40,50], ['stooge 1', 'stooge 2', 'stooge 3']], 'zipped pairs');
// In the case of difference lengths of the tuples undefineds
// should be used as placeholder
stoogesUnzipped = _.unzip(['moe',30],['larry',40],['curly',50, 'extra data']);
deepEqual(stoogesUnzipped, [['moe','larry','curly'],[30,40,50], [undefined, undefined, 'extra data']], 'unzipped pairs');
stooges = _.zip(['moe',30],['larry',40],['curly',50, 'extra data']);
deepEqual(stooges, [['moe','larry','curly'],[30,40,50], [undefined, undefined, 'extra data']], 'zipped pairs with empties');
var emptyUnzipped = _.unzip([]);
deepEqual(emptyUnzipped, [], 'unzipped empty');
var empty = _.zip([]);
deepEqual(empty, [], 'unzipped empty');
});
test('object', function() {

View File

@@ -142,6 +142,20 @@ $(document).ready(function() {
_.delay(function(){ equal(counter, 2, "incr was called twice"); start(); }, 64);
});
asyncTest("more throttling", 3, function() {
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 30);
throttledIncr(); throttledIncr();
ok(counter == 1);
_.delay(function(){
ok(counter == 2);
throttledIncr();
ok(counter == 3);
start();
}, 85);
});
asyncTest("throttle repeatedly with results", 6, function() {
var counter = 0;
var incr = function(){ return ++counter; };
@@ -197,6 +211,42 @@ $(document).ready(function() {
}, 96);
});
asyncTest("more throttle does not trigger leading call when leading is set to false", 3, function() {
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 100, {leading: false});
throttledIncr();
_.delay(throttledIncr, 50);
_.delay(throttledIncr, 60);
_.delay(throttledIncr, 200);
ok(counter === 0);
_.delay(function() {
ok(counter == 1);
}, 250);
_.delay(function() {
ok(counter == 2);
start();
}, 350);
});
asyncTest("one more throttle with leading: false test", 2, function() {
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 100, {leading: false});
var time = new Date;
while (new Date - time < 350) throttledIncr();
ok(counter === 3);
_.delay(function() {
equal(counter, 4);
start();
}, 200);
});
asyncTest("throttle does not trigger trailing call when trailing is set to false", 4, function() {
var counter = 0;
var incr = function(){ counter++; };

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,6 @@
// Underscore.js 1.5.0
// Underscore.js 1.5.1
// http://underscorejs.org
// (c) 2009-2011 Jeremy Ashkenas, DocumentCloud Inc.
// (c) 2011-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function() {
@@ -66,7 +65,7 @@
}
// Current version.
_.VERSION = '1.5.0';
_.VERSION = '1.5.1';
// Collection Functions
// --------------------
@@ -495,16 +494,6 @@
// Zip together multiple lists into a single array -- elements that share
// an index go together.
_.zip = function() {
return _.unzip.apply(_, slice.call(arguments));
};
// The inverse operation to `_.zip`. If given an array of pairs it
// returns an array of the paired elements split into two left and
// right element arrays, if given an array of triples it returns a
// three element array and so on. For example, `_.unzip` given
// `[['a',1],['b',2],['c',3]]` returns the array
// [['a','b','c'],[1,2,3]].
_.unzip = function() {
var length = _.max(_.pluck(arguments, "length").concat(0));
var results = new Array(length);
for (var i = 0; i < length; i++) {
@@ -662,7 +651,7 @@
var previous = 0;
options || (options = {});
var later = function() {
previous = new Date;
previous = options.leading === false ? 0 : new Date;
timeout = null;
result = func.apply(context, args);
};