MCPcopy
hub / github.com/lodash/lodash / baseWhile

Function baseWhile

lodash.js:4433–4443  ·  view source on GitHub ↗

* The base implementation of methods like `_.dropWhile` and `_.takeWhile` * without support for iteratee shorthands. * * @private * @param {Array} array The array to query. * @param {Function} predicate The function invoked per iteration. * @param {boolean} [isDrop] Spe

(array, predicate, isDrop, fromRight)

Source from the content-addressed store, hash-verified

4431 * @returns {Array} Returns the slice of `array`.
4432 */
4433 function baseWhile(array, predicate, isDrop, fromRight) {
4434 var length = array.length,
4435 index = fromRight ? length : -1;
4436
4437 while ((fromRight ? index-- : ++index < length) &&
4438 predicate(array[index], index, array)) {}
4439
4440 return isDrop
4441 ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
4442 : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
4443 }
4444
4445 /**
4446 * The base implementation of `wrapperValue` which returns the result of

Callers 4

dropRightWhileFunction · 0.85
dropWhileFunction · 0.85
takeRightWhileFunction · 0.85
takeWhileFunction · 0.85

Calls 2

baseSliceFunction · 0.85
predicateFunction · 0.50

Tested by

no test coverage detected