Lines Matching defs:collection

766    * without support for iteratee shorthands, which iterates over `collection`
770 * @param {Array|Object} collection The collection to inspect.
772 * @param {Function} eachFunc The function to iterate over `collection`.
775 function baseFindKey(collection, predicate, eachFunc) {
777 eachFunc(collection, function(value, key, collection) {
778 if (predicate(value, key, collection)) {
899 * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
902 * @param {Array|Object} collection The collection to iterate over.
906 * `collection` as the initial value.
907 * @param {Function} eachFunc The function to iterate over `collection`.
910 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
911 eachFunc(collection, function(value, index, collection) {
914 : iteratee(accumulator, value, index, collection);
2498 * Aggregates elements of `collection` on `accumulator` with keys transformed
2502 * @param {Array|Object} collection The collection to iterate over.
2508 function baseAggregator(collection, setter, iteratee, accumulator) {
2509 baseEach(collection, function(value, key, collection) {
2510 setter(accumulator, value, iteratee(value), collection);
2813 * @param {Array|Object} collection The collection to iterate over.
2815 * @returns {Array|Object} Returns `collection`.
2823 * @param {Array|Object} collection The collection to iterate over.
2825 * @returns {Array|Object} Returns `collection`.
2833 * @param {Array|Object} collection The collection to iterate over.
2838 function baseEvery(collection, predicate) {
2840 baseEach(collection, function(value, index, collection) {
2841 result = !!predicate(value, index, collection);
2908 * @param {Array|Object} collection The collection to iterate over.
2912 function baseFilter(collection, predicate) {
2914 baseEach(collection, function(value, index, collection) {
2915 if (predicate(value, index, collection)) {
3534 * @param {Array|Object} collection The collection to iterate over.
3538 function baseMap(collection, iteratee) {
3540 result = isArrayLike(collection) ? Array(collection.length) : [];
3542 baseEach(collection, function(value, key, collection) {
3543 result[++index] = iteratee(value, key, collection);
3716 * @param {Array|Object} collection The collection to iterate over.
3721 function baseOrderBy(collection, iteratees, orders) {
3725 var result = baseMap(collection, function(value, key, collection) {
3935 * @param {Array|Object} collection The collection to sample.
3938 function baseSample(collection) {
3939 return arraySample(values(collection));
3946 * @param {Array|Object} collection The collection to sample.
3950 function baseSampleSize(collection, n) {
3951 var array = values(collection);
4029 * @param {Array|Object} collection The collection to shuffle.
4032 function baseShuffle(collection) {
4033 return shuffleSelf(values(collection));
4070 * @param {Array|Object} collection The collection to iterate over.
4075 function baseSome(collection, predicate) {
4078 baseEach(collection, function(value, index, collection) {
4079 result = predicate(value, index, collection);
4819 return function(collection, iteratee) {
4820 var func = isArray(collection) ? arrayAggregator : baseAggregator,
4823 return func(collection, setter, getIteratee(iteratee, 2), accumulator);
4864 * @param {Function} eachFunc The function to iterate over a collection.
4869 return function(collection, iteratee) {
4870 if (collection == null) {
4871 return collection;
4873 if (!isArrayLike(collection)) {
4874 return eachFunc(collection, iteratee);
4876 var length = collection.length,
4878 iterable = Object(collection);
4885 return collection;
5048 * @param {Function} findIndexFunc The function to find the collection index.
5052 return function(collection, predicate, fromIndex) {
5053 var iterable = Object(collection);
5054 if (!isArrayLike(collection)) {
5056 collection = keys(collection);
5059 var index = findIndexFunc(collection, predicate, fromIndex);
5060 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
6626 * function to avoid garbage collection pauses in V8. See
7263 * of `collection` from right to left.
9057 * each element of `collection` thru `iteratee`. The corresponding value of
9065 * @param {Array|Object} collection The collection to iterate over.
9086 * Checks if `predicate` returns truthy for **all** elements of `collection`.
9088 * invoked with three arguments: (value, index|key, collection).
9099 * @param {Array|Object} collection The collection to iterate over.
9126 function every(collection, predicate, guard) {
9127 var func = isArray(collection) ? arrayEvery : baseEvery;
9128 if (guard && isIterateeCall(collection, predicate, guard)) {
9131 return func(collection, getIteratee(predicate, 3));
9135 * Iterates over elements of `collection`, returning an array of all elements
9137 * arguments: (value, index|key, collection).
9145 * @param {Array|Object} collection The collection to iterate over.
9171 function filter(collection, predicate) {
9172 var func = isArray(collection) ? arrayFilter : baseFilter;
9173 return func(collection, getIteratee(predicate, 3));
9177 * Iterates over elements of `collection`, returning the first element
9179 * arguments: (value, index|key, collection).
9185 * @param {Array|Object} collection The collection to inspect.
9216 * `collection` from right to left.
9222 * @param {Array|Object} collection The collection to inspect.
9224 * @param {number} [fromIndex=collection.length-1] The index to search from.
9236 * Creates a flattened array of values by running each element in `collection`
9238 * with three arguments: (value, index|key, collection).
9244 * @param {Array|Object} collection The collection to iterate over.
9256 function flatMap(collection, iteratee) {
9257 return baseFlatten(map(collection, iteratee), 1);
9268 * @param {Array|Object} collection The collection to iterate over.
9280 function flatMapDeep(collection, iteratee) {
9281 return baseFlatten(map(collection, iteratee), INFINITY);
9292 * @param {Array|Object} collection The collection to iterate over.
9305 function flatMapDepth(collection, iteratee, depth) {
9307 return baseFlatten(map(collection, iteratee), depth);
9311 * Iterates over elements of `collection` and invokes `iteratee` for each element.
9312 * The iteratee is invoked with three arguments: (value, index|key, collection).
9324 * @param {Array|Object} collection The collection to iterate over.
9326 * @returns {Array|Object} Returns `collection`.
9340 function forEach(collection, iteratee) {
9341 var func = isArray(collection) ? arrayEach : baseEach;
9342 return func(collection, getIteratee(iteratee, 3));
9347 * `collection` from right to left.
9354 * @param {Array|Object} collection The collection to iterate over.
9356 * @returns {Array|Object} Returns `collection`.
9365 function forEachRight(collection, iteratee) {
9366 var func = isArray(collection) ? arrayEachRight : baseEachRight;
9367 return func(collection, getIteratee(iteratee, 3));
9372 * each element of `collection` thru `iteratee`. The order of grouped values
9373 * is determined by the order they occur in `collection`. The corresponding
9381 * @param {Array|Object} collection The collection to iterate over.
9402 * Checks if `value` is in `collection`. If `collection` is a string, it's
9406 * the offset from the end of `collection`.
9412 * @param {Array|Object|string} collection The collection to inspect.
9431 function includes(collection, value, fromIndex, guard) {
9432 collection = isArrayLike(collection) ? collection : values(collection);
9435 var length = collection.length;
9439 return isString(collection)
9440 ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
9441 : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
9445 * Invokes the method at `path` of each element in `collection`, returning
9448 * for, and `this` bound to, each element in `collection`.
9454 * @param {Array|Object} collection The collection to iterate over.
9467 var invokeMap = baseRest(function(collection, path, args) {
9470 result = isArrayLike(collection) ? Array(collection.length) : [];
9472 baseEach(collection, function(value) {
9480 * each element of `collection` thru `iteratee`. The corresponding value of
9488 * @param {Array|Object} collection The collection to iterate over.
9511 * Creates an array of values by running each element in `collection` thru
9513 * (value, index|key, collection).
9528 * @param {Array|Object} collection The collection to iterate over.
9552 function map(collection, iteratee) {
9553 var func = isArray(collection) ? arrayMap : baseMap;
9554 return func(collection, getIteratee(iteratee, 3));
9567 * @param {Array|Object} collection The collection to iterate over.
9586 function orderBy(collection, iteratees, orders, guard) {
9587 if (collection == null) {
9597 return baseOrderBy(collection, iteratees, orders);
9610 * @param {Array|Object} collection The collection to iterate over.
9641 * Reduces `collection` to a value which is the accumulated result of running
9642 * each element in `collection` thru `iteratee`, where each successive
9644 * is not given, the first element of `collection` is used as the initial
9646 * (accumulator, value, index|key, collection).
9659 * @param {Array|Object} collection The collection to iterate over.
9677 function reduce(collection, iteratee, accumulator) {
9678 var func = isArray(collection) ? arrayReduce : baseReduce,
9681 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
9686 * `collection` from right to left.
9692 * @param {Array|Object} collection The collection to iterate over.
9706 function reduceRight(collection, iteratee, accumulator) {
9707 var func = isArray(collection) ? arrayReduceRight : baseReduce,
9710 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
9714 * The opposite of `_.filter`; this method returns the elements of `collection`
9721 * @param {Array|Object} collection The collection to iterate over.
9747 function reject(collection, predicate) {
9748 var func = isArray(collection) ? arrayFilter : baseFilter;
9749 return func(collection, negate(getIteratee(predicate, 3)));
9753 * Gets a random element from `collection`.
9759 * @param {Array|Object} collection The collection to sample.
9766 function sample(collection) {
9767 var func = isArray(collection) ? arraySample : baseSample;
9768 return func(collection);
9772 * Gets `n` random elements at unique keys from `collection` up to the
9773 * size of `collection`.
9779 * @param {Array|Object} collection The collection to sample.
9791 function sampleSize(collection, n, guard) {
9792 if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
9797 var func = isArray(collection) ? arraySampleSize : baseSampleSize;
9798 return func(collection, n);
9809 * @param {Array|Object} collection The collection to shuffle.
9816 function shuffle(collection) {
9817 var func = isArray(collection) ? arrayShuffle : baseShuffle;
9818 return func(collection);
9822 * Gets the size of `collection` by returning its length for array-like
9829 * @param {Array|Object|string} collection The collection to inspect.
9830 * @returns {number} Returns the collection size.
9842 function size(collection) {
9843 if (collection == null) {
9846 if (isArrayLike(collection)) {
9847 return isString(collection) ? stringSize(collection) : collection.length;
9849 var tag = getTag(collection);
9851 return collection.size;
9853 return baseKeys(collection).length;
9857 * Checks if `predicate` returns truthy for **any** element of `collection`.
9859 * invoked with three arguments: (value, index|key, collection).
9865 * @param {Array|Object} collection The collection to iterate over.
9892 function some(collection, predicate, guard) {
9893 var func = isArray(collection) ? arraySome : baseSome;
9894 if (guard && isIterateeCall(collection, predicate, guard)) {
9897 return func(collection, getIteratee(predicate, 3));
9902 * running each element in a collection thru each iteratee. This method
9910 * @param {Array|Object} collection The collection to iterate over.
9929 var sortBy = baseRest(function(collection, iteratees) {
9930 if (collection == null) {
9934 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
9939 return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
11447 * Checks if `value` is an empty object, collection, map, or set.
12882 * a collection in the opposite order.