MCPcopy Index your code
hub / github.com/deployd/deployd / createBaseEach

Function createBaseEach

test-app/public/sinon.js:15499–15518  ·  view source on GitHub ↗

* Creates a `baseEach` or `baseEachRight` function. * * @private * @param {Function} eachFunc The function to iterate over a collection. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base functi

(eachFunc, fromRight)

Source from the content-addressed store, hash-verified

15497 * @returns {Function} Returns the new base function.
15498 */
15499 function createBaseEach(eachFunc, fromRight) {
15500 return function(collection, iteratee) {
15501 if (collection == null) {
15502 return collection;
15503 }
15504 if (!isArrayLike(collection)) {
15505 return eachFunc(collection, iteratee);
15506 }
15507 var length = collection.length,
15508 index = fromRight ? length : -1,
15509 iterable = Object(collection);
15510
15511 while ((fromRight ? index-- : ++index < length)) {
15512 if (iteratee(iterable[index], index, iterable) === false) {
15513 break;
15514 }
15515 }
15516 return collection;
15517 };
15518 }
15519
15520 /**
15521 * Creates a base function for methods like `_.forIn` and `_.forOwn`.

Callers 1

sinon.jsFile · 0.85

Calls 2

isArrayLikeFunction · 0.85
iterateeFunction · 0.85

Tested by

no test coverage detected