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.1.7 node_modules/lodash/dropRightWhile.js
boring_generators-0.4.0 tmp/templates/app_template/node_modules/lodash/dropRightWhile.js
tang-0.1.0 spec/tang_app/node_modules/lodash/dropRightWhile.js
tang-0.0.9 spec/tang_app/node_modules/lodash/dropRightWhile.js
trusty-cms-4.1.6 node_modules/lodash/dropRightWhile.js
trusty-cms-4.1.5 node_modules/lodash/dropRightWhile.js
sumomo-0.8.9 data/sumomo/api_modules/node_modules/lodash/dropRightWhile.js
enju_library-0.3.8 spec/dummy/node_modules/lodash/dropRightWhile.js
condenser-0.3 lib/condenser/processors/node_modules/lodash/dropRightWhile.js
sumomo-0.8.8 data/sumomo/api_modules/node_modules/lodash/dropRightWhile.js
ilog-0.4.1 node_modules/lodash/dropRightWhile.js
ilog-0.4.0 node_modules/lodash/dropRightWhile.js
ilog-0.3.3 node_modules/lodash/dropRightWhile.js
condenser-0.2 lib/condenser/processors/node_modules/lodash/dropRightWhile.js
condenser-0.1 lib/condenser/processors/node_modules/lodash/dropRightWhile.js
condenser-0.0.12 lib/condenser/processors/node_modules/lodash/dropRightWhile.js
condenser-0.0.11 lib/condenser/processors/node_modules/lodash/dropRightWhile.js
condenser-0.0.10 lib/condenser/processors/node_modules/lodash/dropRightWhile.js
condenser-0.0.9 lib/condenser/processors/node_modules/lodash/dropRightWhile.js
condenser-0.0.8 lib/condenser/processors/node_modules/lodash/dropRightWhile.js