Sha256: 05527f85693ded63ce891df3aae84d8992f8752792a784789471a0a5a5c69fdb

Contents?: true

Size: 974 Bytes

Versions: 153

Compression:

Stored size: 974 Bytes

Contents

var baseSlice = require('./baseSlice');

/**
 * The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`,
 * and `_.takeWhile` without support for callback shorthands and `this` binding.
 *
 * @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

153 entries across 80 versions & 8 rubygems

Version Path
ilog-0.4.1 node_modules/contents/node_modules/lodash/internal/baseWhile.js
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/baseWhile.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/internal/baseWhile.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/internal/baseWhile.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/internal/baseWhile.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/baseWhile.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/internal/baseWhile.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/internal/baseWhile.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/baseWhile.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseWhile.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseWhile.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseWhile.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseWhile.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseWhile.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseWhile.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/internal/baseWhile.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseWhile.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseWhile.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/baseWhile.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/baseWhile.js