Sha256: f5afc0452542566f343cbf655d26f5f428b3666914beaf4307a53059da1a0b50

Contents?: true

Size: 1.38 KB

Versions: 266

Compression:

Stored size: 1.38 KB

Contents

var baseIteratee = require('./_baseIteratee'),
    baseWhile = require('./_baseWhile');

/**
 * Creates a slice of `array` excluding elements dropped from the end.
 * Elements are dropped until `predicate` returns falsey. The predicate is
 * invoked with three arguments: (value, index, array).
 *
 * @static
 * @memberOf _
 * @since 3.0.0
 * @category Array
 * @param {Array} array The array to query.
 * @param {Function} [predicate=_.identity] The function invoked per iteration.
 * @returns {Array} Returns the slice of `array`.
 * @example
 *
 * var users = [
 *   { 'user': 'barney',  'active': true },
 *   { 'user': 'fred',    'active': false },
 *   { 'user': 'pebbles', 'active': false }
 * ];
 *
 * _.dropRightWhile(users, function(o) { return !o.active; });
 * // => objects for ['barney']
 *
 * // The `_.matches` iteratee shorthand.
 * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
 * // => objects for ['barney', 'fred']
 *
 * // The `_.matchesProperty` iteratee shorthand.
 * _.dropRightWhile(users, ['active', false]);
 * // => objects for ['barney']
 *
 * // The `_.property` iteratee shorthand.
 * _.dropRightWhile(users, 'active');
 * // => objects for ['barney', 'fred', 'pebbles']
 */
function dropRightWhile(array, predicate) {
  return (array && array.length)
    ? baseWhile(array, baseIteratee(predicate, 3), true, true)
    : [];
}

module.exports = dropRightWhile;

Version data entries

266 entries across 264 versions & 30 rubygems

Version Path
disco_app-0.14.0 test/dummy/node_modules/lodash/dropRightWhile.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/lodash/dropRightWhile.js
appmap-0.66.2 ./node_modules/lodash/dropRightWhile.js
trusty-cms-5.0.1 node_modules/lodash/dropRightWhile.js
trusty-cms-4.3.5 node_modules/lodash/dropRightWhile.js
trusty-cms-5.0.0 node_modules/lodash/dropRightWhile.js
appmap-0.66.1 ./node_modules/lodash/dropRightWhile.js
appmap-0.66.0 ./node_modules/lodash/dropRightWhile.js
appmap-0.65.1 ./node_modules/lodash/dropRightWhile.js
appmap-0.65.0 ./node_modules/lodash/dropRightWhile.js
trusty-cms-4.3.4 node_modules/lodash/dropRightWhile.js
sumomo-0.8.12 data/sumomo/api_modules/node_modules/lodash/dropRightWhile.js
appmap-0.64.0 ./node_modules/lodash/dropRightWhile.js
appmap-0.63.0 ./node_modules/lodash/dropRightWhile.js
sumomo-0.8.11 data/sumomo/api_modules/node_modules/lodash/dropRightWhile.js
jekyll-esm-0.0.3 node_modules/lodash/dropRightWhile.js
trusty-cms-4.3.3 node_modules/lodash/dropRightWhile.js
trusty-cms-4.3.2 node_modules/lodash/dropRightWhile.js
trusty-cms-4.3.1 node_modules/lodash/dropRightWhile.js
boring_generators-0.11.0 tmp/templates/app_template/node_modules/lodash/dropRightWhile.js