|
1 | 1 | // Underscore.js 1.4.4
|
2 | 2 | // http://underscorejs.org
|
3 |
| -// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc. |
| 3 | +// (c) 2009-2011 Jeremy Ashkenas, DocumentCloud Inc. |
| 4 | +// (c) 2011-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors |
4 | 5 | // Underscore may be freely distributed under the MIT license.
|
5 | 6 |
|
6 | 7 | (function() {
|
|
21 | 22 | var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
|
22 | 23 |
|
23 | 24 | // Create quick reference variables for speed access to core prototypes.
|
24 |
| - var push = ArrayProto.push, |
25 |
| - slice = ArrayProto.slice, |
26 |
| - concat = ArrayProto.concat, |
27 |
| - toString = ObjProto.toString, |
28 |
| - hasOwnProperty = ObjProto.hasOwnProperty; |
| 25 | + var |
| 26 | + push = ArrayProto.push, |
| 27 | + slice = ArrayProto.slice, |
| 28 | + concat = ArrayProto.concat, |
| 29 | + toString = ObjProto.toString, |
| 30 | + hasOwnProperty = ObjProto.hasOwnProperty; |
29 | 31 |
|
30 | 32 | // All **ECMAScript 5** native function implementations that we hope to use
|
31 | 33 | // are declared here. We don't use native implementations of the array extras
|
|
235 | 237 |
|
236 | 238 | // Return the maximum element or (element-based computation).
|
237 | 239 | // Can't optimize arrays of integers longer than 65,535 elements.
|
238 |
| - // See: https://bugs.webkit.org/show_bug.cgi?id=80797 |
| 240 | + // See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797) |
239 | 241 | _.max = function(obj, iterator, context) {
|
240 | 242 | if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
|
241 | 243 | return Math.max.apply(Math, obj);
|
|
486 | 488 | // `[['a',1],['b',2],['c',3]]` returns the array
|
487 | 489 | // [['a','b','c'],[1,2,3]].
|
488 | 490 | _.unzip = function(tuples) {
|
489 |
| - var results = []; |
490 |
| - _.each(tuples, function (tuple, tupleIndex) { |
491 |
| - _.each(tuple, function (value, itemIndex) { |
492 |
| - if (results.length <= itemIndex) { |
493 |
| - results[itemIndex] = []; |
494 |
| - } |
495 |
| - results[itemIndex][tupleIndex] = value; |
496 |
| - }); |
497 |
| - }); |
498 |
| - return results; |
| 491 | + var maxLen = _.max(_.pluck(tuples, "length")) |
| 492 | + return _.times(maxLen, _.partial(_.pluck, tuples)); |
499 | 493 | };
|
500 | 494 |
|
501 | 495 | // Converts lists into objects. Pass either a single array of `[key, value]`
|
|
835 | 829 | // Internal recursive comparison function for `isEqual`.
|
836 | 830 | var eq = function(a, b, aStack, bStack) {
|
837 | 831 | // Identical objects are equal. `0 === -0`, but they aren't identical.
|
838 |
| - // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal. |
| 832 | + // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). |
839 | 833 | if (a === b) return a !== 0 || 1 / a == 1 / b;
|
840 | 834 | // A strict comparison is necessary because `null == undefined`.
|
841 | 835 | if (a == null || b == null) return a === b;
|
|
0 commit comments