Sha256: 8d25d09663040086d16864b180ed9b04fa02c0d19b6a0d9ff97cd49a8d8be818
Contents?: true
Size: 933 Bytes
Versions: 303
Compression:
Stored size: 933 Bytes
Contents
var baseSlice = require('./_baseSlice'); /** * 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] Specify dropping elements instead of taking them. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the slice of `array`. */ function baseWhile(array, predicate, isDrop, fromRight) { var length = array.length, index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {} return isDrop ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); } module.exports = baseWhile;
Version data entries
303 entries across 279 versions & 33 rubygems