mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
underscore: Avoid regression and cleanup comments. [jddalton]
This commit is contained in:
@@ -262,7 +262,7 @@ $(document).ready(function($, undefined) {
|
|||||||
ok(!_.isEqual({a: 1}, {a: 1, b: 2}), "Commutative equality is implemented for objects");
|
ok(!_.isEqual({a: 1}, {a: 1, b: 2}), "Commutative equality is implemented for objects");
|
||||||
ok(!_.isEqual({x: 1, y: undefined}, {x: 1, z: 2}), "Objects with identical keys and different values are not equivalent");
|
ok(!_.isEqual({x: 1, y: undefined}, {x: 1, z: 2}), "Objects with identical keys and different values are not equivalent");
|
||||||
|
|
||||||
// Objects with shadowing properties
|
// Objects with properties that shadow non-enumerable ones.
|
||||||
ok(!_.isEqual({}, {toString: 1}), "Object with custom toString is not equal to {}");
|
ok(!_.isEqual({}, {toString: 1}), "Object with custom toString is not equal to {}");
|
||||||
ok(_.isEqual({toString: 1, valueOf: 2}, {toString: 1, valueOf: 2}), "Objects with equivalent shadow properties");
|
ok(_.isEqual({toString: 1, valueOf: 2}, {toString: 1, valueOf: 2}), "Objects with equivalent shadow properties");
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
// Create quick reference variables for speed access to core prototypes.
|
// Create quick reference variables for speed access to core prototypes.
|
||||||
var concat = ArrayProto.concat,
|
var concat = ArrayProto.concat,
|
||||||
|
push = ArrayProto.push,
|
||||||
slice = ArrayProto.slice,
|
slice = ArrayProto.slice,
|
||||||
unshift = ArrayProto.unshift,
|
|
||||||
toString = ObjProto.toString,
|
toString = ObjProto.toString,
|
||||||
hasOwnProperty = ObjProto.hasOwnProperty;
|
hasOwnProperty = ObjProto.hasOwnProperty;
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
var i = -1;
|
var i = -1;
|
||||||
var l = obj.length;
|
var l = obj.length;
|
||||||
|
|
||||||
// We optimized for common use by only binding a context when it's passed
|
// We optimize for common use by only binding a context when it's passed.
|
||||||
if (context) {
|
if (context) {
|
||||||
iterator = function() { return fn.call(context, obj[i], i, obj); };
|
iterator = function() { return fn.call(context, obj[i], i, obj); };
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// A simple each, for dealing with non-sparse arrays and arguments objects
|
// A simple each, for dealing with non-sparse arrays and arguments objects.
|
||||||
var simpleEach = function(obj, iterator, index) {
|
var simpleEach = function(obj, iterator, index) {
|
||||||
index || (index = 0);
|
index || (index = 0);
|
||||||
for (var l = obj.length; index < l; index++) {
|
for (var l = obj.length; index < l; index++) {
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
'toLocaleString', 'toString', 'valueOf'
|
'toLocaleString', 'toString', 'valueOf'
|
||||||
];
|
];
|
||||||
|
|
||||||
// IE < 9 makes properties, shadowing non-enumerable ones, non-enumerable too
|
// IE < 9 makes properties, shadowing non-enumerable ones, non-enumerable too.
|
||||||
var forShadowed = !{valueOf:0}.propertyIsEnumerable('valueOf') &&
|
var forShadowed = !{valueOf:0}.propertyIsEnumerable('valueOf') &&
|
||||||
function(obj, iterator) {
|
function(obj, iterator) {
|
||||||
// Because IE < 9 can't set the `[[Enumerable]]` attribute of an existing
|
// Because IE < 9 can't set the `[[Enumerable]]` attribute of an existing
|
||||||
@@ -1021,8 +1021,9 @@
|
|||||||
// A method to easily add functions to the OOP wrapper.
|
// A method to easily add functions to the OOP wrapper.
|
||||||
var addToWrapper = function(name, func) {
|
var addToWrapper = function(name, func) {
|
||||||
wrapper.prototype[name] = function() {
|
wrapper.prototype[name] = function() {
|
||||||
unshift.call(arguments, this._wrapped);
|
var args = [this._wrapped];
|
||||||
return result(func.apply(_, arguments), this._chain);
|
push.apply(args, arguments);
|
||||||
|
return result(func.apply(_, args), this._chain);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user