Write .dropWhile()
This commit is contained in:
parent
a077736466
commit
0f1839555d
1 changed files with 8 additions and 0 deletions
|
@ -70,5 +70,13 @@ _.findKey = function (obj, cb) {
|
|||
|
||||
_.drop = (arr, num = 1) => arr.slice(num)
|
||||
|
||||
/* ----------------------------------------------------------- dropWhile ---- */
|
||||
|
||||
_.dropWhile = function (arr, cb) {
|
||||
const dropTo = arr.findIndex((e, i) => !cb(e, i, arr))
|
||||
|
||||
return this.drop(arr, dropTo)
|
||||
}
|
||||
|
||||
// Do not write or modify code below this line.
|
||||
module.exports = _
|
||||
|
|
Loading…
Reference in a new issue