mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Update vendor/underscore.
Former-commit-id: 3e8a169e8cb81fd852e41420ad317ee12ae486f9
This commit is contained in:
2
vendor/underscore/test/collections.js
vendored
2
vendor/underscore/test/collections.js
vendored
@@ -268,6 +268,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
equal(-Infinity, _.max({}), 'Maximum value of an empty object');
|
equal(-Infinity, _.max({}), 'Maximum value of an empty object');
|
||||||
equal(-Infinity, _.max([]), 'Maximum value of an empty array');
|
equal(-Infinity, _.max([]), 'Maximum value of an empty array');
|
||||||
|
equal(_.max({'a': 'a'}), -Infinity, 'Maximum value of a non-numeric collection');
|
||||||
|
|
||||||
equal(299999, _.max(_.range(1,300000)), "Maximum value of a too-big array");
|
equal(299999, _.max(_.range(1,300000)), "Maximum value of a too-big array");
|
||||||
});
|
});
|
||||||
@@ -280,6 +281,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
equal(Infinity, _.min({}), 'Minimum value of an empty object');
|
equal(Infinity, _.min({}), 'Minimum value of an empty object');
|
||||||
equal(Infinity, _.min([]), 'Minimum value of an empty array');
|
equal(Infinity, _.min([]), 'Minimum value of an empty array');
|
||||||
|
equal(_.min({'a': 'a'}), Infinity, 'Minimum value of a non-numeric collection');
|
||||||
|
|
||||||
var now = new Date(9999999999);
|
var now = new Date(9999999999);
|
||||||
var then = new Date(0);
|
var then = new Date(0);
|
||||||
|
|||||||
2
vendor/underscore/underscore-min.js
vendored
2
vendor/underscore/underscore-min.js
vendored
File diff suppressed because one or more lines are too long
10
vendor/underscore/underscore.js
vendored
10
vendor/underscore/underscore.js
vendored
@@ -61,7 +61,7 @@
|
|||||||
}
|
}
|
||||||
exports._ = _;
|
exports._ = _;
|
||||||
} else {
|
} else {
|
||||||
root['_'] = _;
|
root._ = _;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current version.
|
// Current version.
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
if (obj == null) obj = [];
|
if (obj == null) obj = [];
|
||||||
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
|
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
|
||||||
if (context) iterator = _.bind(iterator, context);
|
if (context) iterator = _.bind(iterator, context);
|
||||||
return arguments.length > 2 ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
|
return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
|
||||||
}
|
}
|
||||||
var length = obj.length;
|
var length = obj.length;
|
||||||
if (length !== +length) {
|
if (length !== +length) {
|
||||||
@@ -239,7 +239,7 @@
|
|||||||
if (_.isEmpty(attrs)) return [];
|
if (_.isEmpty(attrs)) return [];
|
||||||
return _.filter(obj, function(value) {
|
return _.filter(obj, function(value) {
|
||||||
for (var key in attrs) {
|
for (var key in attrs) {
|
||||||
if (attrs[key] !== value[key]) return false;
|
if (_.has(attrs, key) && attrs[key] !== value[key]) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
return Math.max.apply(Math, obj);
|
return Math.max.apply(Math, obj);
|
||||||
}
|
}
|
||||||
if (!iterator && _.isEmpty(obj)) return -Infinity;
|
if (!iterator && _.isEmpty(obj)) return -Infinity;
|
||||||
var result = {computed : -Infinity};
|
var result = {computed : -Infinity, value: -Infinity};
|
||||||
each(obj, function(value, index, list) {
|
each(obj, function(value, index, list) {
|
||||||
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
||||||
computed >= result.computed && (result = {value : value, computed : computed});
|
computed >= result.computed && (result = {value : value, computed : computed});
|
||||||
@@ -267,7 +267,7 @@
|
|||||||
return Math.min.apply(Math, obj);
|
return Math.min.apply(Math, obj);
|
||||||
}
|
}
|
||||||
if (!iterator && _.isEmpty(obj)) return Infinity;
|
if (!iterator && _.isEmpty(obj)) return Infinity;
|
||||||
var result = {computed : Infinity};
|
var result = {computed : Infinity, value: Infinity};
|
||||||
each(obj, function(value, index, list) {
|
each(obj, function(value, index, list) {
|
||||||
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
||||||
computed < result.computed && (result = {value : value, computed : computed});
|
computed < result.computed && (result = {value : value, computed : computed});
|
||||||
|
|||||||
Reference in New Issue
Block a user