UNPKG

1.42 kBMarkdownView Raw
1Finds key of first entry not passing a test.
2[:package:](https://www.npmjs.com/package/@extra-lists/scan-until)
3[:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-lists)
4[:running:](https://npm.runkit.com/@extra-lists/scan-until)
5[:vhs:](https://asciinema.org/a/340789)
6[:moon:](https://www.npmjs.com/package/@extra-lists/scan-until.min)
7[:scroll:](https://unpkg.com/@extra-lists/scan-until/)
8[:newspaper:](https://nodef.github.io/extra-lists/)
9[:blue_book:](https://github.com/nodef/extra-lists/wiki/)
10
11> Alternatives: [scanWhile], [scanUntil].
12
13> This is part of package [extra-lists].
14
15[extra-lists]: https://www.npmjs.com/package/extra-lists
16
17<br>
18
19```javascript
20lists.scanUntil(x, ft);
21// x: lists
22// ft: test function (v, k, x)
23```
24
25```javascript
26const lists = require('extra-lists');
27
28var x = [['a', 'b', 'c', 'd'], [1, 2, 3, 2]];
29lists.scanUntil(x, v => v % 2 === 0);
30// 'b' ^
31
32lists.scanUntil(x, v => v % 8 === 0);
33// undefined
34```
35
36<br>
37<br>
38
39
40## References
41
42- [List-Extra.elemIndex: elm](https://package.elm-lang.org/packages/elm-community/list-extra/7.1.0/List-Extra#elemIndex)
43- [iterable-binsearch: @krisselden](https://www.npmjs.com/package/iterable-binsearch)
44- [binarysearch: @soldair](https://www.npmjs.com/package/binarysearch)
45
46[scanWhile]: https://github.com/nodef/extra-lists/wiki/scanWhile
47[scanUntil]: https://github.com/nodef/extra-lists/wiki/scanUntil