UNPKG

1.66 kBMarkdownView Raw
1Discards values from left, while a test passes.
2[:package:](https://www.npmjs.com/package/@extra-array/drop-while)
3[:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array)
4[:running:](https://npm.runkit.com/@extra-array/drop-while)
5[:vhs:](https://asciinema.org/a/332040)
6[:moon:](https://www.npmjs.com/package/@extra-array/drop-while.min)
7[:scroll:](https://unpkg.com/@extra-array/drop-while/)
8[:newspaper:](https://nodef.github.io/extra-array/)
9[:blue_book:](https://github.com/nodef/extra-array/wiki/)
10
11> Alternatives: [drop], [dropRight], [dropWhile], [dropWhileRight].<br>
12> Similar: [take], [drop].
13
14> This is part of package [extra-array].
15
16[extra-array]: https://www.npmjs.com/package/extra-array
17
18<br>
19
20```javascript
21array.dropWhile(x, ft);
22// x: an array
23// ft: test function (v, i, x)
24```
25
26```javascript
27const array = require("extra-array");
28
29var x = [1, 2, 3, 4, 5];
30array.dropWhile(x, v => v < 3);
31// [ 3, 4, 5 ]
32
33array.dropWhile(x, v => v < 4);
34// [ 4, 5 ]
35```
36
37<br>
38<br>
39
40
41## References
42
43- [Data.List.dropWhile: Haskell](https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-List.html#v:dropWhile)
44- [Array.prototype.slice: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice)
45- [_.dropWhile: lodash](https://lodash.com/docs/4.17.15#dropWhile)
46
47[drop]: https://github.com/nodef/extra-array/wiki/drop
48[dropWhile]: https://github.com/nodef/extra-array/wiki/dropWhile
49[take]: https://github.com/nodef/extra-array/wiki/take
50[dropRight]: https://github.com/nodef/extra-array/wiki/dropRight
51[dropWhileRight]: https://github.com/nodef/extra-array/wiki/dropWhileRight