Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

drop-while

v4.17.11arrow_drop_down
v4.17.11
STATUS
Passing
DOWNLOADS
48
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
7 months ago
SIZE
N/A
subject
Creates a slice of `array` excluding elements dropped from the beginning. Elements are dropped until `predicate` returns falsey.
1 contributor
Use drop-while in your project ?
Copied
npm i @bit/lodash.lodash.drop-while
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
revert changes
reload
toggle layout
maximize
dropWhile(users, function(o) {
  return !o.active;
});
modifieddraft
chevron_left
chevron_right
dropWhile (
array:Array,
predicate:Function?
) : Array

Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate returns falsey. The predicate is invoked with three arguments: (value, index, array).

Example
var users = [
  { 'user': 'barney',  'active': false },
  { 'user': 'fred',    'active': false },
  { 'user': 'pebbles', 'active': true }
];

_.dropWhile(users, function(o) { return !o.active; });
// => objects for ['pebbles']

// The `_.matches` iteratee shorthand.
_.dropWhile(users, { 'user': 'barney', 'active': false });
// => objects for ['fred', 'pebbles']

// The `_.matchesProperty` iteratee shorthand.
_.dropWhile(users, ['active', false]);
// => objects for ['pebbles']

// The `_.property` iteratee shorthand.
_.dropWhile(users, 'active');
// => objects for ['barney', 'fred', 'pebbles']
Arguments
array: Array

The array to query.

predicate: Function?

The function invoked per iteration.

Returns
Array

Returns the slice of `array`.