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
trusty-cms-4.3 node_modules/lodash/dropRightWhile.js
sumomo-0.8.10 data/sumomo/api_modules/node_modules/lodash/dropRightWhile.js
boring_generators-0.10.0 tmp/templates/app_template/node_modules/lodash/dropRightWhile.js
trusty-cms-4.2.3 node_modules/lodash/dropRightWhile.js
boring_generators-0.9.0 tmp/templates/app_template/node_modules/lodash/dropRightWhile.js
tang-0.2.1 spec/tang_app/node_modules/lodash/dropRightWhile.js
trusty-cms-4.2.2 node_modules/lodash/dropRightWhile.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/lodash/dropRightWhile.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/lodash/dropRightWhile.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/lodash/dropRightWhile.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/lodash/dropRightWhile.js
boring_generators-0.8.0 tmp/templates/app_template/node_modules/lodash/dropRightWhile.js
boring_generators-0.7.0 tmp/templates/app_template/node_modules/lodash/dropRightWhile.js
trusty-cms-4.2.1 node_modules/lodash/dropRightWhile.js
trusty-cms-4.2 node_modules/lodash/dropRightWhile.js
trusty-cms-4.1.9 node_modules/lodash/dropRightWhile.js
boring_generators-0.6.0 tmp/templates/app_template/node_modules/lodash/dropRightWhile.js
trusty-cms-4.1.8 node_modules/lodash/dropRightWhile.js
boring_generators-0.5.0 tmp/templates/app_template/node_modules/lodash/dropRightWhile.js
tang-0.2.0 spec/tang_app/node_modules/lodash/dropRightWhile.js