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).
const users = [
{ 'user': 'barney', 'active': true },
{ 'user': 'fred', 'active': true },
{ 'user': 'pebbles', 'active': false }
]
dropWhile(users, ({ active }) => active)
// => objects for ['pebbles']
| Name | Type | Attribute | Description |
|---|---|---|---|
| array | The array to query. | ||
| predicate | The function invoked per iteration. |
{
"comment": "/**\r\n * Creates a slice of `array` excluding elements dropped from the beginning.\r\n * Elements are dropped until `predicate` returns falsey. The predicate is\r\n * invoked with three arguments: (value, index, array).\r\n *\r\n * @since 3.0.0\r\n * @category Array\r\n * @param {Array} array The array to query.\r\n * @param {Function} predicate The function invoked per iteration.\r\n * @returns {Array} Returns the slice of `array`.\r\n * @example\r\n *\r\n * const users = [\r\n * { 'user': 'barney', 'active': true },\r\n * { 'user': 'fred', 'active': true },\r\n * { 'user': 'pebbles', 'active': false }\r\n * ]\r\n *\r\n * dropWhile(users, ({ active }) => active)\r\n * // => objects for ['pebbles']\r\n */",
"meta": {
"range": [
739,
873
],
"filename": "dropWhile.js",
"lineno": 24,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100002068",
"name": "dropWhile",
"type": "FunctionDeclaration",
"paramnames": [
"array",
"predicate"
]
}
},
"description": "Creates a slice of `array` excluding elements dropped from the beginning.\rElements are dropped until `predicate` returns falsey. The predicate is\rinvoked with three arguments: (value, index, array).",
"since": "3.0.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Array",
"value": "Array"
}
],
"params": [
{
"type": {
"names": [
"Array"
]
},
"description": "The array to query.",
"name": "array"
},
{
"type": {
"names": [
"function"
]
},
"description": "The function invoked per iteration.",
"name": "predicate"
}
],
"returns": [
{
"type": {
"names": [
"Array"
]
},
"description": "Returns the slice of `array`."
}
],
"examples": [
"const users = [\r { 'user': 'barney', 'active': true },\r { 'user': 'fred', 'active': true },\r { 'user': 'pebbles', 'active': false }\r]\r\rdropWhile(users, ({ active }) => active)\r// => objects for ['pebbles']"
],
"name": "dropWhile",
"longname": "dropWhile",
"kind": "function",
"scope": "global",
"___id": "T000002R000224",
"___s": true,
"filepath": "dropWhile.js"
}