Lines Matching refs:_

2   var _ = typeof require == 'function' ? require('..') : window._;  variable
9 … assert.deepEqual(_.keys({one: 1, two: 2}), ['one', 'two'], 'can extract the keys from an object');
12 assert.deepEqual(_.keys(a), ['1'], 'is not fooled by sparse arrays; see issue #95');
13 assert.deepEqual(_.keys(null), []);
14 assert.deepEqual(_.keys(void 0), []);
15 assert.deepEqual(_.keys(1), []);
16 assert.deepEqual(_.keys('a'), []);
17 assert.deepEqual(_.keys(true), []);
22 valueOf: _.noop,
35 assert.deepEqual(_.keys(trouble).sort(), troubleKeys, 'matches non-enumerable properties');
39 …assert.deepEqual(_.allKeys({one: 1, two: 2}), ['one', 'two'], 'can extract the allKeys from an obj…
42 assert.deepEqual(_.allKeys(a), ['1'], 'is not fooled by sparse arrays; see issue #95');
45 …assert.deepEqual(_.allKeys(a), ['1', 'a'], 'is not fooled by sparse arrays with additional propert…
47 _.each([null, void 0, 1, 'a', true, NaN, {}, [], new Number(5), new Date(0)], function(val) {
48 assert.deepEqual(_.allKeys(val), []);
54 valueOf: _.noop,
63 assert.deepEqual(_.allKeys(trouble).sort(), troubleKeys, 'matches non-enumerable properties');
69 assert.deepEqual(_.allKeys(b).sort(), ['bar', 'foo'], 'should include inherited keys');
73 assert.deepEqual(_.allKeys(y), ['x'], 'should get keys from constructor');
77 assert.deepEqual(_.values({one: 1, two: 2}), [1, 2], 'can extract the values from an object');
78 …assert.deepEqual(_.values({one: 1, two: 2, length: 3}), [1, 2, 3], '... even when one of them is "…
82 …assert.deepEqual(_.pairs({one: 1, two: 2}), [['one', 1], ['two', 2]], 'can convert an object into …
83 …assert.deepEqual(_.pairs({one: 1, two: 2, length: 3}), [['one', 1], ['two', 2], ['length', 3]], '.…
88 assert.deepEqual(_.keys(_.invert(obj)), ['Moe', 'Larry', 'Curly'], 'can invert an object');
89 assert.deepEqual(_.invert(_.invert(obj)), obj, 'two inverts gets you back where you started');
92 assert.equal(_.invert(obj)['3'], 'length', 'can invert an object with "length"');
96 var obj = {a: 'dash', b: _.map, c: /yo/, d: _.reduce};
97 …assert.deepEqual(['b', 'd'], _.functions(obj), 'can grab the function names of any passed-in objec…
101 assert.deepEqual(_.functions(new Animal), ['run'], 'also looks up functions on the prototype');
105 assert.strictEqual(_.methods, _.functions, 'is an alias for functions');
110 …assert.equal(_.extend({}, {a: 'b'}).a, 'b', 'can extend an object with the attributes of another');
111 assert.equal(_.extend({a: 'x'}, {a: 'b'}).a, 'b', 'properties in source override destination');
112 … assert.equal(_.extend({x: 'x'}, {a: 'b'}).x, 'x', "properties not in source don't get overriden");
113 result = _.extend({x: 'x'}, {a: 'a'}, {b: 'b'});
115 result = _.extend({x: 'x'}, {a: 'a', x: 2}, {a: 'b'});
117 result = _.extend({}, {a: void 0, b: null});
118 assert.deepEqual(_.keys(result), ['a', 'b'], 'extend copies undefined values');
124 …assert.deepEqual(_.extend({}, subObj), {a: 'b', c: 'd'}, 'extend copies all properties from source…
125 _.extend(subObj, {});
130 _.extend(result, null, void 0, {a: 1});
135 assert.strictEqual(_.extend(null, {a: 1}), null, 'extending null results in null');
136 … assert.strictEqual(_.extend(void 0, {a: 1}), void 0, 'extending undefined results in undefined');
141 …assert.equal(_.extendOwn({}, {a: 'b'}).a, 'b', 'can extend an object with the attributes of anothe…
142 … assert.equal(_.extendOwn({a: 'x'}, {a: 'b'}).a, 'b', 'properties in source override destination');
143 …assert.equal(_.extendOwn({x: 'x'}, {a: 'b'}).x, 'x', "properties not in source don't get overriden…
144 result = _.extendOwn({x: 'x'}, {a: 'a'}, {b: 'b'});
146 result = _.extendOwn({x: 'x'}, {a: 'a', x: 2}, {a: 'b'});
148 …assert.deepEqual(_.extendOwn({}, {a: void 0, b: null}), {a: void 0, b: null}, 'copies undefined va…
154 assert.deepEqual(_.extendOwn({}, subObj), {c: 'd'}, 'copies own properties from source');
157 …assert.deepEqual(_.extendOwn(result, null, void 0, {a: 1}), {a: 1}, 'should not error on `null` or…
159 _.each(['a', 5, null, false], function(val) {
160 …assert.strictEqual(_.extendOwn(val, {a: 1}), val, 'extending non-objects results in returning the …
163 …assert.strictEqual(_.extendOwn(void 0, {a: 1}), void 0, 'extending undefined results in undefined'…
165 result = _.extendOwn({a: 1, 0: 2, 1: '5', length: 6}, {0: 1, 1: 2, length: 2});
170 assert.strictEqual(_.assign, _.extendOwn, 'is an alias for extendOwn');
175 result = _.pick({a: 1, b: 2, c: 3}, 'a', 'c');
177 result = _.pick({a: 1, b: 2, c: 3}, ['b', 'c']);
179 result = _.pick({a: 1, b: 2, c: 3}, ['a'], 'b');
181 result = _.pick(['a', 'b'], 1);
184 _.each([null, void 0], function(val) {
185 assert.deepEqual(_.pick(val, 'hasOwnProperty'), {}, 'Called with null/undefined');
186 assert.deepEqual(_.pick(val, _.constant(true)), {});
188 …assert.deepEqual(_.pick(5, 'toString', 'b'), {toString: Number.prototype.toString}, 'can iterate p…
196 result = _.pick(data, callback, {value: 2});
202 assert.deepEqual(_.pick(instance, 'a', 'c'), {a: 1, c: 3}, 'include prototype props');
204 assert.deepEqual(_.pick(data, function(val, key) {
208 …assert.notOk(_.has(_.pick({}, 'foo'), 'foo'), 'does not set own property if property not in object…
209 _.pick(data, function(value, key, obj) {
216 result = _.omit({a: 1, b: 2, c: 3}, 'b');
218 result = _.omit({a: 1, b: 2, c: 3}, 'a', 'c');
220 result = _.omit({a: 1, b: 2, c: 3}, ['b', 'c']);
222 result = _.omit(['a', 'b'], 0);
225 assert.deepEqual(_.omit(null, 'a', 'b'), {}, 'non objects return empty object');
226 assert.deepEqual(_.omit(void 0, 'toString'), {}, 'null/undefined return empty object');
227 assert.deepEqual(_.omit(5, 'toString', 'b'), {}, 'returns empty object for primitives');
235 result = _.omit(data, callback, {value: 2});
241 assert.deepEqual(_.omit(instance, 'b'), {a: 1, c: 3}, 'include prototype props');
243 assert.deepEqual(_.omit(data, function(val, key) {
251 _.defaults(options, {zero: 1, one: 10, twenty: 20, nothing: 'str'});
257 _.defaults(options, {empty: 'full'}, {nan: 'nan'}, {word: 'word'}, {word: 'dog'});
259 assert.ok(_.isNaN(options.nan), "NaN isn't overridden");
264 _.defaults(options, null, void 0, {a: 1});
269 assert.deepEqual(_.defaults(null, {a: 1}), {a: 1}, 'defaults skips nulls');
270 assert.deepEqual(_.defaults(void 0, {a: 1}), {a: 1}, 'defaults skips undefined');
275 var clone = _.clone(moe);
282 assert.equal(_.last(moe.lucky), 101, 'changes to deep attributes are shared with the original');
284 assert.equal(_.clone(void 0), void 0, 'non objects should not be changed by clone');
285 assert.equal(_.clone(1), 1, 'non objects should not be changed by clone');
286 assert.equal(_.clone(null), null, 'non objects should not be changed by clone');
293 _.each(['foo', null, void 0, 1], function(val) {
294 … assert.deepEqual(_.create(val), {}, 'should return empty object when a non-object is provided');
297 …assert.ok(_.create([]) instanceof Array, 'should return new instance of array when array is provid…
300 Child.prototype = _.create(Parent.prototype);
304 Child.prototype = _.create(Parent.prototype, {func: func});
307 Child.prototype = _.create(Parent.prototype, {constructor: Child});
311 var created = _.create(Child.prototype, new Child);
326 assert.ok(_.isEqual(null, null), '`null` is equal to `null`');
327 assert.ok(_.isEqual(), '`undefined` is equal to `undefined`');
329 assert.notOk(_.isEqual(0, -0), '`0` is not equal to `-0`');
330 assert.notOk(_.isEqual(-0, 0), 'Commutative equality is implemented for `0` and `-0`');
331 assert.notOk(_.isEqual(null, void 0), '`null` is not equal to `undefined`');
332 …assert.notOk(_.isEqual(void 0, null), 'Commutative equality is implemented for `null` and `undefin…
335 assert.ok(_.isEqual('Curly', 'Curly'), 'Identical string primitives are equal');
336 …assert.ok(_.isEqual(new String('Curly'), new String('Curly')), 'String objects with identical prim…
337 …assert.ok(_.isEqual(new String('Curly'), 'Curly'), 'String primitives and their corresponding obje…
338 …assert.ok(_.isEqual('Curly', new String('Curly')), 'Commutative equality is implemented for string…
340 …assert.notOk(_.isEqual('Curly', 'Larry'), 'String primitives with different values are not equal');
341 …assert.notOk(_.isEqual(new String('Curly'), new String('Larry')), 'String objects with different p…
342 …assert.notOk(_.isEqual(new String('Curly'), {toString: function(){ return 'Curly'; }}), 'String ob…
345 assert.ok(_.isEqual(75, 75), 'Identical number primitives are equal');
346 …assert.ok(_.isEqual(new Number(75), new Number(75)), 'Number objects with identical primitive valu…
347 …assert.ok(_.isEqual(75, new Number(75)), 'Number primitives and their corresponding object wrapper…
348 …assert.ok(_.isEqual(new Number(75), 75), 'Commutative equality is implemented for number objects a…
349 assert.notOk(_.isEqual(new Number(0), -0), '`new Number(0)` and `-0` are not equal');
350 …assert.notOk(_.isEqual(0, new Number(-0)), 'Commutative equality is implemented for `new Number(0)…
352 …assert.notOk(_.isEqual(new Number(75), new Number(63)), 'Number objects with different primitive v…
353 …assert.notOk(_.isEqual(new Number(63), {valueOf: function(){ return 63; }}), 'Number objects and o…
356 assert.ok(_.isEqual(NaN, NaN), '`NaN` is equal to `NaN`');
357 assert.ok(_.isEqual(new Number(NaN), NaN), 'Object(`NaN`) is equal to `NaN`');
358 assert.notOk(_.isEqual(61, NaN), 'A number primitive is not equal to `NaN`');
359 assert.notOk(_.isEqual(new Number(79), NaN), 'A number object is not equal to `NaN`');
360 assert.notOk(_.isEqual(Infinity, NaN), '`Infinity` is not equal to `NaN`');
363 assert.ok(_.isEqual(true, true), 'Identical boolean primitives are equal');
364 …assert.ok(_.isEqual(new Boolean, new Boolean), 'Boolean objects with identical primitive values ar…
365 …assert.ok(_.isEqual(true, new Boolean(true)), 'Boolean primitives and their corresponding object w…
366 … assert.ok(_.isEqual(new Boolean(true), true), 'Commutative equality is implemented for booleans');
367 …assert.notOk(_.isEqual(new Boolean(true), new Boolean), 'Boolean objects with different primitive …
370 … assert.notOk(_.isEqual(new Boolean(false), true), '`new Boolean(false)` is not equal to `true`');
371 … assert.notOk(_.isEqual('75', 75), 'String and number primitives with like values are not equal');
372 …assert.notOk(_.isEqual(new Number(63), new String(63)), 'String and number objects with like value…
373 …assert.notOk(_.isEqual(75, '75'), 'Commutative equality is implemented for like string and number …
374 assert.notOk(_.isEqual(0, ''), 'Number and string primitives with like values are not equal');
375 … assert.notOk(_.isEqual(1, true), 'Number and boolean primitives with like values are not equal');
376 …assert.notOk(_.isEqual(new Boolean(false), new Number(0)), 'Boolean and number objects with like v…
377 …assert.notOk(_.isEqual(false, new String('')), 'Boolean primitives and string objects with like va…
378 …assert.notOk(_.isEqual(12564504e5, new Date(2009, 9, 25)), 'Dates and their corresponding numeric …
381 …assert.ok(_.isEqual(new Date(2009, 9, 25), new Date(2009, 9, 25)), 'Date objects referencing ident…
382 …assert.notOk(_.isEqual(new Date(2009, 9, 25), new Date(2009, 11, 13)), 'Date objects referencing d…
383 assert.notOk(_.isEqual(new Date(2009, 11, 13), {
388 assert.notOk(_.isEqual(new Date('Curly'), new Date('Curly')), 'Invalid dates are not equal');
391 …assert.notOk(_.isEqual(First, Second), 'Different functions with identical bodies and source code …
394 …assert.ok(_.isEqual(/(?:)/gim, /(?:)/gim), 'RegExps with equivalent patterns and flags are equal');
395 assert.ok(_.isEqual(/(?:)/gi, /(?:)/ig), 'Flag order is not significant');
396 …assert.notOk(_.isEqual(/(?:)/g, /(?:)/gi), 'RegExps with equivalent patterns and different flags a…
397 …assert.notOk(_.isEqual(/Moe/gim, /Curly/gim), 'RegExps with different patterns and equivalent flag…
398 assert.notOk(_.isEqual(/(?:)/gi, /(?:)/g), 'Commutative equality is implemented for RegExps');
399 …assert.notOk(_.isEqual(/Curly/g, {source: 'Larry', global: true, ignoreCase: false, multiline: fal…
402 assert.ok(_.isEqual({}, {}), 'Empty object literals are equal');
403 assert.ok(_.isEqual([], []), 'Empty array literals are equal');
404 assert.ok(_.isEqual([{}], [{}]), 'Empty nested arrays and objects are equal');
405 assert.notOk(_.isEqual({length: 0}, []), 'Array-like objects and arrays are not equal.');
406 …assert.notOk(_.isEqual([], {length: 0}), 'Commutative equality is implemented for array-like objec…
408 assert.notOk(_.isEqual({}, []), 'Object literals and array literals are not equal');
409 assert.notOk(_.isEqual([], {}), 'Commutative equality is implemented for objects and arrays');
412 …assert.ok(_.isEqual([1, 'Larry', true], [1, 'Larry', true]), 'Arrays containing identical primitiv…
413 …assert.ok(_.isEqual([/Moe/g, new Date(2009, 9, 25)], [/Moe/g, new Date(2009, 9, 25)]), 'Arrays con…
418 …assert.ok(_.isEqual(a, b), 'Arrays containing nested arrays and objects are recursively compared');
425 …assert.ok(_.isEqual(a, b), 'Arrays containing equivalent elements and different non-numeric proper…
427 assert.notOk(_.isEqual(a, b), 'Arrays of different lengths are not equal');
430 …assert.notOk(_.isEqual(a, b), 'Arrays of identical lengths containing different elements are not e…
433 assert.ok(_.isEqual(Array(3), Array(3)), 'Sparse arrays of identical lengths are equal');
434 …assert.notOk(_.isEqual(Array(3), Array(6)), 'Sparse arrays of different lengths are not equal when…
438 assert.ok(_.isEqual(sparse, [void 0, 5]), 'Handles sparse arrays as dense');
441 …assert.ok(_.isEqual({a: 'Curly', b: 1, c: true}, {a: 'Curly', b: 1, c: true}), 'Objects containing…
442 …assert.ok(_.isEqual({a: /Curly/g, b: new Date(2009, 11, 13)}, {a: /Curly/g, b: new Date(2009, 11, …
443 …assert.notOk(_.isEqual({a: 63, b: 75}, {a: 61, b: 55}), 'Objects of identical sizes with different…
444 …assert.notOk(_.isEqual({a: 63, b: 75}, {a: 61, c: 55}), 'Objects of identical sizes with different…
445 assert.notOk(_.isEqual({a: 1, b: 2}, {a: 1}), 'Objects of different sizes are not equal');
446 … assert.notOk(_.isEqual({a: 1}, {a: 1, b: 2}), 'Commutative equality is implemented for objects');
447 …assert.notOk(_.isEqual({x: 1, y: void 0}, {x: 1, z: 2}), 'Objects with identical keys and differen…
478 assert.ok(_.isEqual(a, b), 'Objects with nested equivalent members are recursively compared');
481 assert.ok(_.isEqual(new First, new First), 'Object instances are equal');
482 …assert.notOk(_.isEqual(new First, new Second), 'Objects with different constructors and identical …
483 …assert.notOk(_.isEqual({value: 1}, new First), 'Object instances and objects sharing equivalent pr…
484 …assert.notOk(_.isEqual({value: 2}, new Second), 'The prototype chain of objects should not be exam…
489 assert.ok(_.isEqual(a, b), 'Arrays containing circular references are equal');
492 …assert.ok(_.isEqual(a, b), 'Arrays containing circular references and equivalent properties are eq…
495 …assert.notOk(_.isEqual(a, b), 'Arrays containing circular references and different properties are …
501 …assert.notOk(_.isEqual(a, b), 'Comparison of circular references with non-circular references are …
508 assert.ok(_.isEqual(a, b), 'Objects containing circular references are equal');
511 …assert.ok(_.isEqual(a, b), 'Objects containing circular references and equivalent properties are e…
514 …assert.notOk(_.isEqual(a, b), 'Objects containing circular references and different properties are…
520 …assert.notOk(_.isEqual(a, b), 'Comparison of circular references with non-circular object referenc…
527 assert.ok(_.isEqual(a, b), 'Cyclic structures are equal');
530 assert.ok(_.isEqual(a, b), 'Cyclic structures containing equivalent properties are equal');
533 … assert.notOk(_.isEqual(a, b), 'Cyclic structures containing different properties are not equal');
540 …assert.ok(_.isEqual(a, b), 'Cyclic structures with nested and identically-named properties are equ…
543 …assert.notOk(_.isEqual(_({x: 1, y: void 0}).chain(), _({x: 1, z: 2}).chain()), 'Chained objects co…
545 a = _({x: 1, y: 2}).chain();
546 b = _({x: 1, y: 2}).chain();
547 assert.equal(_.isEqual(a.isEqual(b), _(true)), true, '`isEqual` can be chained');
553 assert.ok(_.isEqual(a, b), 'Handles objects without a constructor (e.g. from Object.create');
560 …assert.strictEqual(_.isEqual(new Foo, other), false, 'Objects from different constructors are not …
564 assert.equal(_.isEqual([0], [-0]), false);
565 assert.equal(_.isEqual({a: 0}, {a: -0}), false);
566 assert.equal(_.isEqual([NaN], [NaN]), true);
567 assert.equal(_.isEqual({a: NaN}, {a: NaN}), true);
571 assert.strictEqual(_.isEqual(symbol, symbol), true, 'A symbol is equal to itself');
572 assert.strictEqual(_.isEqual(symbol, Object(symbol)), true, 'Even when wrapped in Object()');
573 assert.strictEqual(_.isEqual(symbol, null), false, 'Different types are not equal');
579 assert.notOk(_([1]).isEmpty(), '[1] is not empty');
580 assert.ok(_.isEmpty([]), '[] is empty');
581 assert.notOk(_.isEmpty({one: 1}), '{one: 1} is not empty');
582 assert.ok(_.isEmpty({}), '{} is empty');
583 assert.ok(_.isEmpty(new RegExp('')), 'objects with prototype properties are empty');
584 assert.ok(_.isEmpty(null), 'null is empty');
585 assert.ok(_.isEmpty(), 'undefined is empty');
586 assert.ok(_.isEmpty(''), 'the empty string is empty');
587 assert.notOk(_.isEmpty('moe'), 'but other strings are not');
591 assert.ok(_.isEmpty(obj), 'deleting all the keys from an object empties it');
594 assert.ok(_.isEmpty(args()), 'empty arguments object is empty');
595 assert.notOk(_.isEmpty(args('')), 'non-empty arguments object is not empty');
599 assert.notOk(_.isEmpty(nonEnumProp), 'non-enumerable property is not empty');
604 assert.notOk(_.isElement('div'), 'strings are not dom elements');
605 assert.ok(_.isElement(testElement), 'an element is a DOM element');
611 assert.notOk(_.isArguments('string'), 'a string is not an arguments object');
612 assert.notOk(_.isArguments(_.isArguments), 'a function is not an arguments object');
613 assert.ok(_.isArguments(args), 'but the arguments object is an arguments object');
614 assert.notOk(_.isArguments(_.toArray(args)), 'but not when it\'s converted into an array');
615 assert.notOk(_.isArguments([1, 2, 3]), 'and not vanilla arrays.');
619 assert.ok(_.isObject(arguments), 'the arguments object is object');
620 assert.ok(_.isObject([1, 2, 3]), 'and arrays');
622 assert.ok(_.isObject(testElement), 'and DOM element');
624 assert.ok(_.isObject(function() {}), 'and functions');
625 assert.notOk(_.isObject(null), 'but not null');
626 assert.notOk(_.isObject(void 0), 'and not undefined');
627 assert.notOk(_.isObject('string'), 'and not string');
628 assert.notOk(_.isObject(12), 'and not number');
629 assert.notOk(_.isObject(true), 'and not boolean');
630 assert.ok(_.isObject(new String('string')), 'but new String()');
634 assert.notOk(_.isArray(void 0), 'undefined vars are not arrays');
635 assert.notOk(_.isArray(arguments), 'the arguments object is not an array');
636 assert.ok(_.isArray([1, 2, 3]), 'but arrays are');
642 assert.notOk(_.isString(testElement), 'an element is not a string');
644 assert.ok(_.isString([1, 2, 3].join(', ')), 'but strings are');
645 assert.strictEqual(_.isString('I am a string literal'), true, 'string literals are');
646 assert.ok(_.isString(obj), 'so are String objects');
647 assert.strictEqual(_.isString(1), false);
651 assert.notOk(_.isSymbol(0), 'numbers are not symbols');
652 assert.notOk(_.isSymbol(''), 'strings are not symbols');
653 assert.notOk(_.isSymbol(_.isSymbol), 'functions are not symbols');
655 assert.ok(_.isSymbol(Symbol()), 'symbols are symbols');
656 assert.ok(_.isSymbol(Symbol('description')), 'described symbols are symbols');
657 assert.ok(_.isSymbol(Object(Symbol())), 'boxed symbols are symbols');
662 assert.notOk(_.isNumber('string'), 'a string is not a number');
663 assert.notOk(_.isNumber(arguments), 'the arguments object is not a number');
664 assert.notOk(_.isNumber(void 0), 'undefined is not a number');
665 assert.ok(_.isNumber(3 * 4 - 7 / 10), 'but numbers are');
666 assert.ok(_.isNumber(NaN), 'NaN *is* a number');
667 assert.ok(_.isNumber(Infinity), 'Infinity is a number');
668 assert.notOk(_.isNumber('1'), 'numeric strings are not numbers');
672 assert.notOk(_.isBoolean(2), 'a number is not a boolean');
673 assert.notOk(_.isBoolean('string'), 'a string is not a boolean');
674 assert.notOk(_.isBoolean('false'), 'the string "false" is not a boolean');
675 assert.notOk(_.isBoolean('true'), 'the string "true" is not a boolean');
676 assert.notOk(_.isBoolean(arguments), 'the arguments object is not a boolean');
677 assert.notOk(_.isBoolean(void 0), 'undefined is not a boolean');
678 assert.notOk(_.isBoolean(NaN), 'NaN is not a boolean');
679 assert.notOk(_.isBoolean(null), 'null is not a boolean');
680 assert.ok(_.isBoolean(true), 'but true is');
681 assert.ok(_.isBoolean(false), 'and so is false');
685 assert.notOk(_.isMap('string'), 'a string is not a map');
686 assert.notOk(_.isMap(2), 'a number is not a map');
687 assert.notOk(_.isMap({}), 'an object is not a map');
688 assert.notOk(_.isMap(false), 'a boolean is not a map');
689 assert.notOk(_.isMap(void 0), 'undefined is not a map');
690 assert.notOk(_.isMap([1, 2, 3]), 'an array is not a map');
692 assert.notOk(_.isMap(new Set()), 'a set is not a map');
695 assert.notOk(_.isMap(new WeakSet()), 'a weakset is not a map');
698 assert.notOk(_.isMap(new WeakMap()), 'a weakmap is not a map');
704 assert.ok(_.isMap(obj), 'but a map is');
709 assert.notOk(_.isWeakMap('string'), 'a string is not a weakmap');
710 assert.notOk(_.isWeakMap(2), 'a number is not a weakmap');
711 assert.notOk(_.isWeakMap({}), 'an object is not a weakmap');
712 assert.notOk(_.isWeakMap(false), 'a boolean is not a weakmap');
713 assert.notOk(_.isWeakMap(void 0), 'undefined is not a weakmap');
714 assert.notOk(_.isWeakMap([1, 2, 3]), 'an array is not a weakmap');
716 assert.notOk(_.isWeakMap(new Set()), 'a set is not a weakmap');
719 assert.notOk(_.isWeakMap(new WeakSet()), 'a weakset is not a weakmap');
722 assert.notOk(_.isWeakMap(new Map()), 'a map is not a weakmap');
727 assert.ok(_.isWeakMap(obj), 'but a weakmap is');
732 assert.notOk(_.isSet('string'), 'a string is not a set');
733 assert.notOk(_.isSet(2), 'a number is not a set');
734 assert.notOk(_.isSet({}), 'an object is not a set');
735 assert.notOk(_.isSet(false), 'a boolean is not a set');
736 assert.notOk(_.isSet(void 0), 'undefined is not a set');
737 assert.notOk(_.isSet([1, 2, 3]), 'an array is not a set');
739 assert.notOk(_.isSet(new Map()), 'a map is not a set');
742 assert.notOk(_.isSet(new WeakMap()), 'a weakmap is not a set');
745 assert.notOk(_.isSet(new WeakSet()), 'a weakset is not a set');
750 assert.ok(_.isSet(obj), 'but a set is');
756 assert.notOk(_.isWeakSet('string'), 'a string is not a weakset');
757 assert.notOk(_.isWeakSet(2), 'a number is not a weakset');
758 assert.notOk(_.isWeakSet({}), 'an object is not a weakset');
759 assert.notOk(_.isWeakSet(false), 'a boolean is not a weakset');
760 assert.notOk(_.isWeakSet(void 0), 'undefined is not a weakset');
761 assert.notOk(_.isWeakSet([1, 2, 3]), 'an array is not a weakset');
763 assert.notOk(_.isWeakSet(new Map()), 'a map is not a weakset');
766 assert.notOk(_.isWeakSet(new WeakMap()), 'a weakmap is not a weakset');
769 assert.notOk(_.isWeakSet(new Set()), 'a set is not a weakset');
774 assert.ok(_.isWeakSet(obj), 'but a weakset is');
779 assert.notOk(_.isFunction(void 0), 'undefined vars are not functions');
780 assert.notOk(_.isFunction([1, 2, 3]), 'arrays are not functions');
781 assert.notOk(_.isFunction('moe'), 'strings are not functions');
782 assert.ok(_.isFunction(_.isFunction), 'but functions are');
783 assert.ok(_.isFunction(function(){}), 'even anonymous ones');
786 assert.notOk(_.isFunction(testElement), 'elements are not functions');
791 assert.notOk(_.isFunction(nodelist));
797_.chain(['Float32Array', 'Float64Array', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'U…
798 .map(_.propertyOf(typeof GLOBAL != 'undefined' ? GLOBAL : window))
803 …assert.strictEqual(_.isFunction(TypedArray), Object.prototype.toString.call(TypedArray) === '[obje…
809 assert.notOk(_.isDate(100), 'numbers are not dates');
810 assert.notOk(_.isDate({}), 'objects are not dates');
811 assert.ok(_.isDate(new Date()), 'but dates are');
815 assert.notOk(_.isRegExp(_.identity), 'functions are not RegExps');
816 assert.ok(_.isRegExp(/identity/), 'but RegExps are');
820 assert.notOk(_.isFinite(void 0), 'undefined is not finite');
821 assert.notOk(_.isFinite(null), 'null is not finite');
822 assert.notOk(_.isFinite(NaN), 'NaN is not finite');
823 assert.notOk(_.isFinite(Infinity), 'Infinity is not finite');
824 assert.notOk(_.isFinite(-Infinity), '-Infinity is not finite');
825 assert.ok(_.isFinite('12'), 'Numeric strings are numbers');
826 assert.notOk(_.isFinite('1a'), 'Non numeric strings are not numbers');
827 assert.notOk(_.isFinite(''), 'Empty strings are not numbers');
829 assert.ok(_.isFinite(obj), 'Number instances can be finite');
830 assert.ok(_.isFinite(0), '0 is finite');
831 assert.ok(_.isFinite(123), 'Ints are finite');
832 assert.ok(_.isFinite(-12.44), 'Floats are finite');
834 assert.notOk(_.isFinite(Symbol()), 'symbols are not numbers');
835 assert.notOk(_.isFinite(Symbol('description')), 'described symbols are not numbers');
836 assert.notOk(_.isFinite(Object(Symbol())), 'boxed symbols are not numbers');
841 assert.notOk(_.isNaN(void 0), 'undefined is not NaN');
842 assert.notOk(_.isNaN(null), 'null is not NaN');
843 assert.notOk(_.isNaN(0), '0 is not NaN');
844 assert.notOk(_.isNaN(new Number(0)), 'wrapped 0 is not NaN');
845 assert.ok(_.isNaN(NaN), 'but NaN is');
846 assert.ok(_.isNaN(new Number(NaN)), 'wrapped NaN is still NaN');
848 assert.notOk(_.isNaN(Symbol()), 'symbol is not NaN');
853 assert.notOk(_.isNull(void 0), 'undefined is not null');
854 assert.notOk(_.isNull(NaN), 'NaN is not null');
855 assert.ok(_.isNull(null), 'but null is');
859 assert.notOk(_.isUndefined(1), 'numbers are defined');
860 assert.notOk(_.isUndefined(null), 'null is defined');
861 assert.notOk(_.isUndefined(false), 'false is defined');
862 assert.notOk(_.isUndefined(NaN), 'NaN is defined');
863 assert.ok(_.isUndefined(), 'nothing is undefined');
864 assert.ok(_.isUndefined(void 0), 'undefined is undefined');
868 assert.notOk(_.isError(1), 'numbers are not Errors');
869 assert.notOk(_.isError(null), 'null is not an Error');
870 assert.notOk(_.isError(Error), 'functions are not Errors');
871 assert.ok(_.isError(new Error()), 'Errors are Errors');
872 assert.ok(_.isError(new EvalError()), 'EvalErrors are Errors');
873 assert.ok(_.isError(new RangeError()), 'RangeErrors are Errors');
874 assert.ok(_.isError(new ReferenceError()), 'ReferenceErrors are Errors');
875 assert.ok(_.isError(new SyntaxError()), 'SyntaxErrors are Errors');
876 assert.ok(_.isError(new TypeError()), 'TypeErrors are Errors');
877 assert.ok(_.isError(new URIError()), 'URIErrors are Errors');
883 var returned = _.tap(1, interceptor);
887 returned = _([1, 2, 3]).chain().
898 assert.ok(_.has(obj, 'foo'), 'has() checks that the object has a property.');
899 assert.notOk(_.has(obj, 'baz'), "has() returns false if the object doesn't have the property.");
900 assert.ok(_.has(obj, 'func'), 'has() works for functions too.');
902 assert.ok(_.has(obj, 'foo'), 'has() works even when the hasOwnProperty method is deleted.');
905 assert.notOk(_.has(child, 'foo'), 'has() does not check the prototype chain for a property.');
906 assert.strictEqual(_.has(null, 'foo'), false, 'has() returns false for null');
907 assert.strictEqual(_.has(void 0, 'foo'), false, 'has() returns false for undefined');
914 assert.equal(_.isMatch(moe, {hair: true}), true, 'Returns a boolean');
915 assert.equal(_.isMatch(curly, {hair: true}), false, 'Returns a boolean');
917 assert.equal(_.isMatch(5, {__x__: void 0}), false, 'can match undefined props on primitives');
918 assert.equal(_.isMatch({__x__: void 0}, {__x__: void 0}), true, 'can match undefined props');
920 assert.equal(_.isMatch(null, {}), true, 'Empty spec called with null object returns true');
921 …assert.equal(_.isMatch(null, {a: 1}), false, 'Non-empty spec called with null object returns false…
923_.each([null, void 0], function(item) { assert.strictEqual(_.isMatch(item, null), true, 'null matc…
924_.each([null, void 0], function(item) { assert.strictEqual(_.isMatch(item, null), true, 'null matc…
925 assert.strictEqual(_.isMatch({b: 1}, {a: void 0}), false, 'handles undefined values (1683)');
927 _.each([true, 5, NaN, null, void 0], function(item) {
928 assert.strictEqual(_.isMatch({a: 1}, item), true, 'treats primitives as empty');
934 assert.equal(_.isMatch({x: 2}, specObj), true, 'spec is restricted to own properties');
937 assert.equal(_.isMatch({x: 1, y: 5}, specObj), true);
938 assert.equal(_.isMatch({x: 1, y: 4}, specObj), false);
940 …assert.ok(_.isMatch(specObj, {x: 1, y: 5}), 'inherited and own properties are checked on the test …
943 assert.ok(_.isMatch({x: 5, y: 1}, Prototest), 'spec can be a function');
947 …assert.deepEqual(_.map([null, void 0, 5, {}], _.partial(_.isMatch, _, oCon)), [false, false, false…
955 assert.equal(_.matcher({hair: true})(moe), true, 'Returns a boolean');
956 assert.equal(_.matcher({hair: true})(curly), false, 'Returns a boolean');
958 assert.equal(_.matcher({__x__: void 0})(5), false, 'can match undefined props on primitives');
959 assert.equal(_.matcher({__x__: void 0})({__x__: void 0}), true, 'can match undefined props');
961 assert.equal(_.matcher({})(null), true, 'Empty spec called with null object returns true');
962 …assert.equal(_.matcher({a: 1})(null), false, 'Non-empty spec called with null object returns false…
964 …assert.strictEqual(_.find(stooges, _.matcher({hair: false})), curly, 'returns a predicate that can…
965 …assert.strictEqual(_.find(stooges, _.matcher(moe)), moe, 'can be used to locate an object exists i…
966 … assert.deepEqual(_.filter([null, void 0], _.matcher({a: 1})), [], 'Do not throw on null values.');
968 … assert.deepEqual(_.filter([null, void 0], _.matcher(null)), [null, void 0], 'null matches null');
969 assert.deepEqual(_.filter([null, void 0], _.matcher({})), [null, void 0], 'null matches {}');
970 …assert.deepEqual(_.filter([{b: 1}], _.matcher({a: void 0})), [], 'handles undefined values (1683)'…
972 _.each([true, 5, NaN, null, void 0], function(item) {
973 assert.equal(_.matcher(item)({a: 1}), true, 'treats primitives as empty');
979 var protospec = _.matcher(specObj);
983 protospec = _.matcher(specObj);
987 …assert.ok(_.matcher({x: 1, y: 5})(specObj), 'inherited and own properties are checked on the test …
990 assert.ok(_.matcher(Prototest)({x: 5, y: 1}), 'spec can be a function');
994 var m = _.matcher(o);
1003 var oCon = _.matcher({constructor: Object});
1004 …assert.deepEqual(_.map([null, void 0, 5, {}], oCon), [false, false, false, true], 'doesnt falsey m…
1008 assert.strictEqual(_.matches, _.matcher, 'is an alias for matcher');
1018 assert.equal(_.findKey(objects, function(obj) {
1022 assert.equal(_.findKey(objects, function(obj) {
1026 assert.equal(_.findKey(objects, 'a'), 'b', 'Uses lookupIterator');
1028 assert.equal(_.findKey(objects, function(obj) {
1032 assert.strictEqual(_.findKey([1, 2, 3, 4, 5, 6], function(obj) {
1036 assert.strictEqual(_.findKey(objects, function(a) {
1040 _.findKey({a: {a: 1}}, function(a, key, obj) {
1048 …assert.strictEqual(_.findKey(array, function(x) { return x === 55; }), 'match', 'matches array-lik…
1060 assert.deepEqual(_.mapObject(obj, function(val) {
1064 assert.deepEqual(_.mapObject(objects, function(val) {
1065 return _.reduce(val, function(memo, v){
1070 assert.deepEqual(_.mapObject(obj, function(val, key, o) {
1074 assert.deepEqual(_.mapObject([1, 2], function(val) {
1078 assert.deepEqual(_.mapObject(obj, function(val) {
1082 assert.deepEqual(_.mapObject({a: 1}, function() {
1086 var ids = _.mapObject({length: 2, 0: {id: '1'}, 1: {id: '2'}}, function(n){
1093 …assert.deepEqual(_.mapObject(people, 'name'), {a: 'moe', b: 'curly'}, 'predicate string map to obj…
1095 _.each([null, void 0, 1, 'abc', [], {}, void 0], function(val){
1096 assert.deepEqual(_.mapObject(val, _.identity), {}, 'mapValue identity');
1102 …assert.deepEqual(_.mapObject(protoObj, _.identity), {a: 1}, 'ignore inherited values from prototyp…