mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 11:57:49 +00:00
Update vendors.
This commit is contained in:
14
vendor/underscore/test/collections.js
vendored
14
vendor/underscore/test/collections.js
vendored
@@ -59,19 +59,15 @@
|
||||
|
||||
QUnit.test('Iterating objects with sketchy length properties', function(assert) {
|
||||
var functions = [
|
||||
'each', 'map', 'filter', 'find',
|
||||
'some', 'every', 'max', 'min',
|
||||
'groupBy', 'countBy', 'partition', 'indexBy'
|
||||
'each', 'map', 'filter', 'find',
|
||||
'some', 'every', 'max', 'min',
|
||||
'groupBy', 'countBy', 'partition', 'indexBy'
|
||||
];
|
||||
var reducers = ['reduce', 'reduceRight'];
|
||||
|
||||
var tricks = [
|
||||
{length: '5'},
|
||||
{
|
||||
length: {
|
||||
valueOf: _.constant(5)
|
||||
}
|
||||
},
|
||||
{length: {valueOf: _.constant(5)}},
|
||||
{length: Math.pow(2, 53) + 1},
|
||||
{length: Math.pow(2, 53)},
|
||||
{length: null},
|
||||
@@ -821,7 +817,7 @@
|
||||
var actual;
|
||||
try {
|
||||
actual = _.toArray(document.childNodes);
|
||||
} catch(e) { /* ignored */ }
|
||||
} catch (e) { /* ignored */ }
|
||||
assert.deepEqual(actual, _.map(document.childNodes, _.identity), 'works on NodeList');
|
||||
}
|
||||
});
|
||||
|
||||
3
vendor/underscore/test/functions.js
vendored
3
vendor/underscore/test/functions.js
vendored
@@ -90,7 +90,8 @@
|
||||
});
|
||||
|
||||
QUnit.test('bindAll', function(assert) {
|
||||
var curly = {name: 'curly'}, moe = {
|
||||
var curly = {name: 'curly'};
|
||||
var moe = {
|
||||
name: 'moe',
|
||||
getName: function() { return 'name: ' + this.name; },
|
||||
sayHi: function() { return 'hi: ' + this.name; }
|
||||
|
||||
14
vendor/underscore/test/objects.js
vendored
14
vendor/underscore/test/objects.js
vendored
@@ -128,7 +128,7 @@
|
||||
try {
|
||||
result = {};
|
||||
_.extend(result, null, void 0, {a: 1});
|
||||
} catch(e) { /* ignored */ }
|
||||
} catch (e) { /* ignored */ }
|
||||
|
||||
assert.equal(result.a, 1, 'should not error on `null` or `undefined` sources');
|
||||
|
||||
@@ -262,7 +262,7 @@
|
||||
try {
|
||||
options = {};
|
||||
_.defaults(options, null, void 0, {a: 1});
|
||||
} catch(e) { /* ignored */ }
|
||||
} catch (e) { /* ignored */ }
|
||||
|
||||
assert.equal(options.a, 1, 'should not error on `null` or `undefined` sources');
|
||||
|
||||
@@ -842,14 +842,14 @@
|
||||
|
||||
assert.ok(_.find(stooges, _.matcher({hair: false})) === curly, 'returns a predicate that can be used by finding functions.');
|
||||
assert.ok(_.find(stooges, _.matcher(moe)) === moe, 'can be used to locate an object exists in a collection.');
|
||||
assert.deepEqual(_.where([null, void 0], {a: 1}), [], 'Do not throw on null values.');
|
||||
assert.deepEqual(_.filter([null, void 0], _.matcher({a: 1})), [], 'Do not throw on null values.');
|
||||
|
||||
assert.deepEqual(_.where([null, void 0], null), [null, void 0], 'null matches null');
|
||||
assert.deepEqual(_.where([null, void 0], {}), [null, void 0], 'null matches {}');
|
||||
assert.deepEqual(_.where([{b: 1}], {a: void 0}), [], 'handles undefined values (1683)');
|
||||
assert.deepEqual(_.filter([null, void 0], _.matcher(null)), [null, void 0], 'null matches null');
|
||||
assert.deepEqual(_.filter([null, void 0], _.matcher({})), [null, void 0], 'null matches {}');
|
||||
assert.deepEqual(_.filter([{b: 1}], _.matcher({a: void 0})), [], 'handles undefined values (1683)');
|
||||
|
||||
_.each([true, 5, NaN, null, void 0], function(item) {
|
||||
assert.deepEqual(_.where([{a: 1}], item), [{a: 1}], 'treats primitives as empty');
|
||||
assert.equal(_.matcher(item)({a: 1}), true, 'treats primitives as empty');
|
||||
});
|
||||
|
||||
function Prototest() {}
|
||||
|
||||
20
vendor/underscore/underscore.js
vendored
20
vendor/underscore/underscore.js
vendored
@@ -22,18 +22,16 @@
|
||||
var ArrayProto = Array.prototype, ObjProto = Object.prototype;
|
||||
|
||||
// Create quick reference variables for speed access to core prototypes.
|
||||
var
|
||||
push = ArrayProto.push,
|
||||
slice = ArrayProto.slice,
|
||||
toString = ObjProto.toString,
|
||||
hasOwnProperty = ObjProto.hasOwnProperty;
|
||||
var push = ArrayProto.push,
|
||||
slice = ArrayProto.slice,
|
||||
toString = ObjProto.toString,
|
||||
hasOwnProperty = ObjProto.hasOwnProperty;
|
||||
|
||||
// All **ECMAScript 5** native function implementations that we hope to use
|
||||
// are declared here.
|
||||
var
|
||||
nativeIsArray = Array.isArray,
|
||||
nativeKeys = Object.keys,
|
||||
nativeCreate = Object.create;
|
||||
var nativeIsArray = Array.isArray,
|
||||
nativeKeys = Object.keys,
|
||||
nativeCreate = Object.create;
|
||||
|
||||
// Naked function reference for surrogate-prototype-swapping.
|
||||
var Ctor = function(){};
|
||||
@@ -998,8 +996,8 @@
|
||||
_.mapObject = function(obj, iteratee, context) {
|
||||
iteratee = cb(iteratee, context);
|
||||
var keys = _.keys(obj),
|
||||
length = keys.length,
|
||||
results = {};
|
||||
length = keys.length,
|
||||
results = {};
|
||||
for (var index = 0; index < length; index++) {
|
||||
var currentKey = keys[index];
|
||||
results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
|
||||
|
||||
Reference in New Issue
Block a user