Lines Matching refs:_

2   var _ = typeof require == 'function' ? require('..') : window._;  variable
7 _.each([1, 2, 3], function(num, i) {
12 _.each([1, 2, 3], function(num){ answers.push(num * this.multiplier); }, {multiplier: 5});
16 _.each([1, 2, 3], function(num){ answers.push(num); });
22 _.each(obj, function(value, key){ answers.push(key); });
27 _(1000).times(function() { _.each([], function(){}); });
30 _.each(obj, function(){ count++; });
34 _.each([1, 2, 3], function(num, index, arr){ if (_.include(arr, num)) answer = true; });
38 _.each(null, function(){ ++answers; });
41 _.each(false, function(){});
44 assert.strictEqual(_.each(a, function(){}), a);
45 assert.strictEqual(_.each(null, function(){}), null);
49 assert.strictEqual(_.forEach, _.each, 'is an alias for each');
53 _.each([true, false, 'yes', '', 0, 1, {}], function(context) {
54 _.each([1], function() {
70 {length: {valueOf: _.constant(5)}},
80 _.each(tricks, function(trick) {
82 assert.strictEqual(_.size(trick), 1, 'size on obj with length: ' + length);
83 assert.deepEqual(_.toArray(trick), [length], 'toArray on obj with length: ' + length);
84 assert.deepEqual(_.shuffle(trick), [length], 'shuffle on obj with length: ' + length);
85 assert.deepEqual(_.sample(trick), length, 'sample on obj with length: ' + length);
88 _.each(functions, function(method) {
89 _[method](trick, function(val, key) {
94 _.each(reducers, function(method) {
95 assert.strictEqual(_[method](trick), trick.length, method);
115 _.each(collection.concat(array), function(method) {
119 _[method](sparseArray, function(){
126 _[method](growingCollection, function() {
133 _.each(collection.concat(object), function(method) {
135 _[method](changingObject, function(val) {
145 var doubled = _.map([1, 2, 3], function(num){ return num * 2; });
148 var tripled = _.map([1, 2, 3], function(num){ return num * this.multiplier; }, {multiplier: 3});
151 doubled = _([1, 2, 3]).map(function(num){ return num * 2; });
154 var ids = _.map({length: 2, 0: {id: '1'}, 1: {id: '2'}}, function(n){
159 assert.deepEqual(_.map(null, _.noop), [], 'handles a null properly');
161 assert.deepEqual(_.map([1], function() {
167 …assert.deepEqual(_.map(people, 'name'), ['moe', 'curly'], 'predicate string map to object properti…
171 assert.strictEqual(_.collect, _.map, 'is an alias for map');
175 var sum = _.reduce([1, 2, 3], function(memo, num){ return memo + num; }, 0);
179 …sum = _.reduce([1, 2, 3], function(memo, num){ return memo + num * this.multiplier; }, 0, context);
182 sum = _([1, 2, 3]).reduce(function(memo, num){ return memo + num; }, 0);
185 sum = _.reduce([1, 2, 3], function(memo, num){ return memo + num; });
188 var prod = _.reduce([1, 2, 3, 4], function(memo, num){ return memo * num; });
191 …assert.strictEqual(_.reduce(null, _.noop, 138), 138, 'handles a null (with initial value) properly…
192 assert.equal(_.reduce([], _.noop, void 0), void 0, 'undefined can be passed as a special case');
193 …assert.equal(_.reduce([_], _.noop), _, 'collection of length one with no initial value returns the…
194 …assert.equal(_.reduce([], _.noop), void 0, 'returns undefined when collection is empty and no init…
198 assert.strictEqual(_.foldl, _.reduce, 'is an alias for reduce');
202 assert.strictEqual(_.inject, _.reduce, 'is an alias for reduce');
206 var list = _.reduceRight(['foo', 'bar', 'baz'], function(memo, str){ return memo + str; }, '');
209 list = _.reduceRight(['foo', 'bar', 'baz'], function(memo, str){ return memo + str; });
212 var sum = _.reduceRight({a: 1, b: 2, c: 3}, function(memo, num){ return memo + num; });
215 …assert.strictEqual(_.reduceRight(null, _.noop, 138), 138, 'handles a null (with initial value) pro…
216 …assert.equal(_.reduceRight([_], _.noop), _, 'collection of length one with no initial value return…
218 …assert.equal(_.reduceRight([], _.noop, void 0), void 0, 'undefined can be passed as a special case…
219 …assert.equal(_.reduceRight([], _.noop), void 0, 'returns undefined when collection is empty and no…
226 lastKey = _.keys(object).pop();
232 _.reduceRight(object, function() {
233 if (!args) args = _.toArray(arguments);
241 lastKey = _.keys(object).pop();
248 _.reduceRight(object, function() {
249 if (!args) args = _.toArray(arguments);
256 assert.strictEqual(_.foldr, _.reduceRight, 'is an alias for reduceRight');
261 …assert.strictEqual(_.find(array, function(n) { return n > 2; }), 3, 'should return first found `va…
262 …assert.strictEqual(_.find(array, function() { return false; }), void 0, 'should return `undefined`…
265 …assert.strictEqual(_.find(array, function(x) { return x === 55; }), void 0, 'iterates array-likes …
269 assert.deepEqual(_.find(list, {a: 1}), {a: 1, b: 2}, 'can be used as findWhere');
270 assert.deepEqual(_.find(list, {b: 4}), {a: 1, b: 4});
271 assert.notOk(_.find(list, {c: 1}), 'undefined when not found');
272 assert.notOk(_.find([], {c: 1}), 'undefined when searching empty list');
274 var result = _.find([1, 2, 3], function(num){ return num * 2 === 4; });
284 assert.deepEqual(_.find(obj, {x: 2}), {x: 2, z: 2}, 'works on objects');
285 assert.deepEqual(_.find(obj, {x: 2, z: 1}), void 0);
286 assert.deepEqual(_.find(obj, function(x) {
290 _.findIndex([{a: 1}], function(a, key, o) {
293 assert.strictEqual(this, _, 'called with context');
294 }, _);
298 assert.strictEqual(_.detect, _.find, 'is an alias for find');
306 assert.deepEqual(_.filter(evenArray, isEven), [2, 4, 6]);
307 assert.deepEqual(_.filter(evenObject, isEven), [2], 'can filter objects');
308 …assert.deepEqual(_.filter([{}, evenObject, []], 'two'), [evenObject], 'predicate string map to obj…
310 _.filter([1], function() {
316 assert.deepEqual(_.filter(list, {a: 1}), [{a: 1, b: 2}, {a: 1, b: 3}, {a: 1, b: 4}]);
317 assert.deepEqual(_.filter(list, {b: 2}), [{a: 1, b: 2}, {a: 2, b: 2}]);
318 assert.deepEqual(_.filter(list, {}), list, 'Empty object accepts all items');
319 assert.deepEqual(_(list).filter({}), list, 'OO-filter');
323 assert.strictEqual(_.select, _.filter, 'is an alias for filter');
327 var odds = _.reject([1, 2, 3, 4, 5, 6], function(num){ return num % 2 === 0; });
332 var evens = _.reject([1, 2, 3, 4, 5, 6], function(num){
338 …assert.deepEqual(_.reject([odds, {one: 1, two: 2, three: 3}], 'two'), [odds], 'predicate string ma…
342 assert.deepEqual(_.reject(list, {a: 1}), [{a: 2, b: 2}]);
343 assert.deepEqual(_.reject(list, {b: 2}), [{a: 1, b: 3}, {a: 1, b: 4}]);
344 assert.deepEqual(_.reject(list, {}), [], 'Returns empty list given empty object');
345 assert.deepEqual(_.reject(list, []), [], 'Returns empty list given empty array');
349 assert.ok(_.every([], _.identity), 'the empty set');
350 assert.ok(_.every([true, true, true], _.identity), 'every true values');
351 assert.notOk(_.every([true, false, true], _.identity), 'one false value');
352 assert.ok(_.every([0, 10, 28], function(num){ return num % 2 === 0; }), 'even numbers');
353 assert.notOk(_.every([0, 11, 28], function(num){ return num % 2 === 0; }), 'an odd number');
354 assert.strictEqual(_.every([1], _.identity), true, 'cast to boolean - true');
355 assert.strictEqual(_.every([0], _.identity), false, 'cast to boolean - false');
356 assert.notOk(_.every([void 0, void 0, void 0], _.identity), 'works with arrays of undefined');
359 assert.notOk(_.every(list, {a: 1, b: 2}), 'Can be called with object');
360 assert.ok(_.every(list, 'a'), 'String mapped to object property');
363 assert.ok(_.every(list, {b: 2}), 'Can be called with object');
364 assert.notOk(_.every(list, 'c'), 'String mapped to object property');
366 assert.ok(_.every({a: 1, b: 2, c: 3, d: 4}, _.isNumber), 'takes objects');
367 assert.notOk(_.every({a: 1, b: 2, c: 3, d: 4}, _.isObject), 'takes objects');
368 …assert.ok(_.every(['a', 'b', 'c', 'd'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context work…
369 …assert.notOk(_.every(['a', 'b', 'c', 'd', 'f'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'cont…
373 assert.strictEqual(_.all, _.every, 'is an alias for every');
377 assert.notOk(_.some([]), 'the empty set');
378 assert.notOk(_.some([false, false, false]), 'all false values');
379 assert.ok(_.some([false, false, true]), 'one true value');
380 assert.ok(_.some([null, 0, 'yes', false]), 'a string');
381 assert.notOk(_.some([null, 0, '', false]), 'falsy values');
382 assert.notOk(_.some([1, 11, 29], function(num){ return num % 2 === 0; }), 'all odd numbers');
383 assert.ok(_.some([1, 10, 29], function(num){ return num % 2 === 0; }), 'an even number');
384 assert.strictEqual(_.some([1], _.identity), true, 'cast to boolean - true');
385 assert.strictEqual(_.some([0], _.identity), false, 'cast to boolean - false');
386 assert.ok(_.some([false, false, true]));
389 assert.notOk(_.some(list, {a: 5, b: 2}), 'Can be called with object');
390 assert.ok(_.some(list, 'a'), 'String mapped to object property');
393 assert.ok(_.some(list, {b: 2}), 'Can be called with object');
394 assert.notOk(_.some(list, 'd'), 'String mapped to object property');
396 assert.ok(_.some({a: '1', b: '2', c: '3', d: '4', e: 6}, _.isNumber), 'takes objects');
397 assert.notOk(_.some({a: 1, b: 2, c: 3, d: 4}, _.isObject), 'takes objects');
398 …assert.ok(_.some(['a', 'b', 'c', 'd'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works…
399 …assert.notOk(_.some(['x', 'y', 'z'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works');
403 assert.strictEqual(_.any, _.some, 'is an alias for some');
407 _.each([null, void 0, 0, 1, NaN, {}, []], function(val) {
408 assert.strictEqual(_.includes(val, 'hasOwnProperty'), false);
410 assert.strictEqual(_.includes([1, 2, 3], 2), true, 'two is in the array');
411 assert.notOk(_.includes([1, 3, 9], 2), 'two is not in the array');
413 …assert.strictEqual(_.includes([5, 4, 3, 2, 1], 5, true), true, 'doesn\'t delegate to binary search…
415 …assert.strictEqual(_.includes({moe: 1, larry: 3, curly: 9}, 3), true, '_.includes on objects check…
416 assert.ok(_([1, 2, 3]).includes(2), 'OO-style includes');
419 assert.strictEqual(_.includes(numbers, 1, 1), true, 'takes a fromIndex');
420 assert.strictEqual(_.includes(numbers, 1, -1), false, 'takes a fromIndex');
421 assert.strictEqual(_.includes(numbers, 1, -2), false, 'takes a fromIndex');
422 assert.strictEqual(_.includes(numbers, 1, -3), true, 'takes a fromIndex');
423 assert.strictEqual(_.includes(numbers, 1, 6), true, 'takes a fromIndex');
424 assert.strictEqual(_.includes(numbers, 1, 7), false, 'takes a fromIndex');
426 assert.ok(_.every([1, 2, 3], _.partial(_.includes, numbers)), 'fromIndex is guarded');
430 assert.strictEqual(_.include, _.includes, 'is an alias for includes');
434 assert.strictEqual(_.contains, _.includes, 'is an alias for includes');
439 …assert.strictEqual(_.includes([1, 2, NaN, NaN], NaN), true, 'Expected [1, 2, NaN] to contain NaN');
440 …assert.strictEqual(_.includes([1, 2, Infinity], NaN), false, 'Expected [1, 2, NaN] to contain NaN'…
444 _.each([-0, +0], function(val) {
445 assert.strictEqual(_.includes([1, 2, val, val], val), true);
446 assert.strictEqual(_.includes([1, 2, val, val], -val), true);
447 assert.strictEqual(_.includes([-1, 1, 2], -val), false);
455 var result = _.invoke(list, 'sort');
459 _.invoke([{
461 assert.deepEqual(_.toArray(arguments), [1, 2, 3], 'called with arguments');
465 …assert.deepEqual(_.invoke([{a: null}, {}, {a: _.constant(1)}], 'a'), [null, void 0, 1], 'handles n…
468 _.invoke([{a: 1}], 'a');
474 var result = _.invoke(list, Array.prototype.sort);
478 assert.deepEqual(_.invoke([1, 2, 3], function(a) {
491 var result = _.invoke(list, 'sort');
500 assert.deepEqual(_.pluck(people, 'name'), ['moe', 'curly'], 'pulls names out of objects');
501 …assert.deepEqual(_.pluck(people, 'address'), [void 0, void 0], 'missing properties are returned as…
503 assert.deepEqual(_.pluck([{'[object Object]': 1}], {}), [1]);
508 var result = _.where(list, {a: 1});
511 result = _.where(list, {b: 2});
514 result = _.where(list, {});
518 test.map = _.map;
519 … assert.deepEqual(_.where([_, {a: 1, b: 2}, _], test), [_, _], 'checks properties given function');
524 var result = _.findWhere(list, {a: 1});
526 result = _.findWhere(list, {b: 4});
529 result = _.findWhere(list, {c: 1});
530 assert.ok(_.isUndefined(result), 'undefined when not found');
532 result = _.findWhere([], {c: 1});
533 assert.ok(_.isUndefined(result), 'undefined when searching empty list');
536 test.map = _.map;
537 assert.equal(_.findWhere([_, {a: 1, b: 2}, _], test), _, 'checks properties given function');
544 …assert.deepEqual(_.findWhere([{y: 5, b: 6}, expect], new TestClass()), expect, 'uses class instanc…
548 assert.equal(-Infinity, _.max(null), 'can handle null/undefined');
549 assert.equal(-Infinity, _.max(void 0), 'can handle null/undefined');
550 assert.equal(-Infinity, _.max(null, _.identity), 'can handle null/undefined');
552 assert.equal(_.max([1, 2, 3]), 3, 'can perform a regular Math.max');
554 var neg = _.max([1, 2, 3], function(num){ return -num; });
557 assert.equal(-Infinity, _.max({}), 'Maximum value of an empty object');
558 assert.equal(-Infinity, _.max([]), 'Maximum value of an empty array');
559 assert.equal(_.max({a: 'a'}), -Infinity, 'Maximum value of a non-numeric collection');
561 assert.equal(_.max(_.range(1, 300000)), 299999, 'Maximum value of a too-big array');
563 …assert.equal(_.max([1, 2, 3, 'test']), 3, 'Finds correct max in array starting with num and contai…
564 assert.equal(_.max(['test', 1, 2, 3]), 3, 'Finds correct max in array starting with NaN');
566 …assert.equal(_.max([1, 2, 3, null]), 3, 'Finds correct max in array starting with num and containi…
567 assert.equal(_.max([null, 1, 2, 3]), 3, 'Finds correct max in array starting with a `null`');
569 …assert.equal(_.max([1, 2, 3, '']), 3, 'Finds correct max in array starting with num and containing…
570 … assert.equal(_.max(['', 1, 2, 3]), 3, 'Finds correct max in array starting with an empty string');
572 …assert.equal(_.max([1, 2, 3, false]), 3, 'Finds correct max in array starting with num and contain…
573 assert.equal(_.max([false, 1, 2, 3]), 3, 'Finds correct max in array starting with a false');
575 assert.equal(_.max([0, 1, 2, 3, 4]), 4, 'Finds correct max in array containing a zero');
576 … assert.equal(_.max([-3, -2, -1, 0]), 0, 'Finds correct max in array containing negative numbers');
578 …assert.deepEqual(_.map([[1, 2, 3], [4, 5, 6]], _.max), [3, 6], 'Finds correct max in array when ma…
583 assert.equal(_.max([a, b], iterator), a, 'Respects iterator return value of -Infinity');
585 …assert.deepEqual(_.max([{a: 1}, {a: 0, b: 3}, {a: 4}, {a: 2}], 'a'), {a: 4}, 'String keys use prop…
587 … assert.deepEqual(_.max([0, 2], function(c){ return c * this.x; }, {x: 1}), 2, 'Iterator context');
588 assert.deepEqual(_.max([[1], [2, 3], [-1, 4], [5]], 0), [5], 'Lookup falsy iterator');
589 assert.deepEqual(_.max([{0: 1}, {0: 2}, {0: -1}, {a: 1}], 0), {0: 2}, 'Lookup falsy iterator');
593 assert.equal(_.min(null), Infinity, 'can handle null/undefined');
594 assert.equal(_.min(void 0), Infinity, 'can handle null/undefined');
595 assert.equal(_.min(null, _.identity), Infinity, 'can handle null/undefined');
597 assert.equal(_.min([1, 2, 3]), 1, 'can perform a regular Math.min');
599 var neg = _.min([1, 2, 3], function(num){ return -num; });
602 assert.equal(_.min({}), Infinity, 'Minimum value of an empty object');
603 assert.equal(_.min([]), Infinity, 'Minimum value of an empty array');
604 assert.equal(_.min({a: 'a'}), Infinity, 'Minimum value of a non-numeric collection');
606 …assert.deepEqual(_.map([[1, 2, 3], [4, 5, 6]], _.min), [1, 4], 'Finds correct min in array when ma…
610 assert.equal(_.min([now, then]), then);
612 assert.equal(_.min(_.range(1, 300000)), 1, 'Minimum value of a too-big array');
614 …assert.equal(_.min([1, 2, 3, 'test']), 1, 'Finds correct min in array starting with num and contai…
615 assert.equal(_.min(['test', 1, 2, 3]), 1, 'Finds correct min in array starting with NaN');
617 …assert.equal(_.min([1, 2, 3, null]), 1, 'Finds correct min in array starting with num and containi…
618 assert.equal(_.min([null, 1, 2, 3]), 1, 'Finds correct min in array starting with a `null`');
620 assert.equal(_.min([0, 1, 2, 3, 4]), 0, 'Finds correct min in array containing a zero');
621 …assert.equal(_.min([-3, -2, -1, 0]), -3, 'Finds correct min in array containing negative numbers');
626 assert.equal(_.min([a, b], iterator), a, 'Respects iterator return value of Infinity');
628 …assert.deepEqual(_.min([{a: 1}, {a: 0, b: 3}, {a: 4}, {a: 2}], 'a'), {a: 0, b: 3}, 'String keys us…
630 …assert.deepEqual(_.min([0, 2], function(c){ return c * this.x; }, {x: -1}), 2, 'Iterator context');
631 assert.deepEqual(_.min([[1], [2, 3], [-1, 4], [5]], 0), [-1, 4], 'Lookup falsy iterator');
632 assert.deepEqual(_.min([{0: 1}, {0: 2}, {0: -1}, {a: 1}], 0), {0: -1}, 'Lookup falsy iterator');
637 people = _.sortBy(people, function(person){ return person.age; });
638 assert.deepEqual(_.pluck(people, 'name'), ['moe', 'curly'], 'stooges sorted by age');
641 …assert.deepEqual(_.sortBy(list, _.identity), [1, 2, 3, 4, void 0, void 0], 'sortBy with undefined …
644 var sorted = _.sortBy(list, 'length');
664 var stableObject = _.object('abcdefghijklmnopqr'.split(''), stableArray);
666 var actual = _.sortBy(stableArray, function(pair) {
671 assert.deepEqual(_.sortBy(stableArray, 'x'), stableArray, 'sortBy accepts property string');
673 actual = _.sortBy(stableObject, function(pair) {
680 …assert.deepEqual(_.sortBy(list), ['e', 'q', 'r', 't', 'w', 'y'], 'uses _.identity if iterator is n…
684 var parity = _.groupBy([1, 2, 3, 4, 5, 6], function(num){ return num % 2; });
689 var grouped = _.groupBy(list, 'length');
695 _.groupBy([{}], function(){ assert.strictEqual(this, context); }, context);
697 grouped = _.groupBy([4.2, 6.1, 6.4], function(num) {
704 _.groupBy(array, function(value, index, obj){ assert.strictEqual(obj, array); });
707 grouped = _.groupBy(array);
716 assert.deepEqual(_.groupBy(matrix, 0), {1: [[1, 2], [1, 3]], 2: [[2, 3]]});
717 assert.deepEqual(_.groupBy(matrix, 1), {2: [[1, 2]], 3: [[1, 3], [2, 3]]});
721 var parity = _.indexBy([1, 2, 3, 4, 5], function(num){ return num % 2 === 0; });
726 var grouped = _.indexBy(list, 'length');
732 grouped = _.indexBy(array);
739 var parity = _.countBy([1, 2, 3, 4, 5], function(num){ return num % 2 === 0; });
744 var grouped = _.countBy(list, 'length');
750 _.countBy([{}], function(){ assert.strictEqual(this, context); }, context);
752 grouped = _.countBy([4.2, 6.1, 6.4], function(num) {
759 _.countBy(array, function(value, index, obj){ assert.strictEqual(obj, array); });
762 grouped = _.countBy(array);
768 assert.deepEqual(_.shuffle([1]), [1], 'behaves correctly on size 1 arrays');
769 var numbers = _.range(20);
770 var shuffled = _.shuffle(numbers);
773 …assert.deepEqual(numbers, _.sortBy(shuffled), 'contains the same members before and after shuffle'…
775 shuffled = _.shuffle({a: 1, b: 2, c: 3, d: 4});
781 assert.strictEqual(_.sample([1]), 1, 'behaves correctly when no second parameter is given');
782 assert.deepEqual(_.sample([1, 2, 3], -2), [], 'behaves correctly on negative n');
783 var numbers = _.range(10);
784 var allSampled = _.sample(numbers, 10).sort();
786 allSampled = _.sample(numbers, 20).sort();
788 …assert.ok(_.contains(numbers, _.sample(numbers)), 'sampling a single element returns something fro…
789 … assert.strictEqual(_.sample([]), void 0, 'sampling empty array with no number returns undefined');
790 …assert.notStrictEqual(_.sample([], 5), [], 'sampling empty array with a number returns an empty ar…
791 …assert.notStrictEqual(_.sample([1, 2, 3], 0), [], 'sampling an array with 0 picks returns an empty…
792 …assert.deepEqual(_.sample([1, 2], -1), [], 'sampling a negative number of picks returns an empty a…
793 … assert.ok(_.contains([1, 2, 3], _.sample({a: 1, b: 2, c: 3})), 'sample one value from an object');
794 var partialSample = _.sample(_.range(1000), 10);
796 …assert.notDeepEqual(partialSampleSorted, _.range(10), 'samples from the whole array, not just the …
800 assert.notOk(_.isArray(arguments), 'arguments object is not an array');
801 assert.ok(_.isArray(_.toArray(arguments)), 'arguments object converted into array');
803 assert.notStrictEqual(_.toArray(a), a, 'array is cloned');
804 assert.deepEqual(_.toArray(a), [1, 2, 3], 'cloned array contains same elements');
806 var numbers = _.toArray({one: 1, two: 2, three: 3});
812 assert.deepEqual(_.toArray(expected.join('')), expected, 'maintains astral characters');
813 assert.deepEqual(_.toArray(''), [], 'empty string into empty array');
819 actual = _.toArray(document.childNodes);
821 assert.deepEqual(actual, _.map(document.childNodes, _.identity), 'works on NodeList');
826 assert.equal(_.size({one: 1, two: 2, three: 3}), 3, 'can compute the size of an object');
827 assert.equal(_.size([1, 2, 3]), 3, 'can compute the size of an array');
828 assert.equal(_.size({length: 3, 0: 0, 1: 0, 2: 0}), 3, 'can compute the size of Array-likes');
831 return _.size(arguments);
836 assert.equal(_.size('hello'), 5, 'can compute the size of a string literal');
837 assert.equal(_.size(new String('hello')), 5, 'can compute the size of string object');
839 assert.equal(_.size(null), 0, 'handles nulls');
840 assert.equal(_.size(0), 0, 'handles numbers');
845 …assert.deepEqual(_.partition(list, function(x) { return x < 4; }), [[0, 1, 2, 3], [4, 5]], 'handle…
846 …assert.deepEqual(_.partition(list, function(x) { return x & 1; }), [[1, 3, 5], [0, 2, 4]], 'handle…
847 …assert.deepEqual(_.partition(list, function(x) { return x - 3; }), [[0, 1, 2, 4, 5], [3]], 'handle…
848 …assert.deepEqual(_.partition(list, function(x) { return x > 1 ? null : true; }), [[0, 1], [2, 3, 4…
849 …assert.deepEqual(_.partition(list, function(x) { if (x < 2) return true; }), [[0, 1], [2, 3, 4, 5]…
850 …assert.deepEqual(_.partition({a: 1, b: 2, c: 3}, function(x) { return x > 1; }), [[2, 3], [1]], 'h…
852 …assert.deepEqual(_.partition(list, function(x, index) { return index % 2; }), [[1, 3, 5], [0, 2, 4…
853 …assert.deepEqual(_.partition(list, function(x, index, arr) { return x === arr.length - 1; }), [[5]…
856 … assert.deepEqual(_.partition([1, false, true, '']), [[1, true], [false, '']], 'Default iterator');
857 …assert.deepEqual(_.partition([{x: 1}, {x: 0}, {x: 1}], 'x'), [[{x: 1}, {x: 1}], [{x: 0}]], 'Takes …
861 …assert.deepEqual(_.partition([1, 2, 3], predicate, {x: 2}), [[2], [1, 3]], 'partition takes a cont…
863 …assert.deepEqual(_.partition([{a: 1}, {b: 2}, {a: 1, b: 2}], {a: 1}), [[{a: 1}, {a: 1, b: 2}], [{b…
866 _.partition(object, function(val, key, obj) {
879 var elementChildren = _.filter(parent.childNodes, _.isElement);
882 assert.deepEqual(_.map(elementChildren, 'id'), ['id1', 'id2']);
883 assert.deepEqual(_.map(parent.childNodes, 'nodeType'), [1, 3, 1]);
885 assert.notOk(_.every(parent.childNodes, _.isElement));
886 assert.ok(_.some(parent.childNodes, _.isElement));
889 return _.isElement(node) ? node.id.charAt(2) : void 0;
891 assert.equal(_.max(parent.childNodes, compareNode), _.last(parent.childNodes));
892 assert.equal(_.min(parent.childNodes, compareNode), _.first(parent.childNodes));