Miss any of our Open RFC calls?Watch the recordings here! »

@extra-entries/scan-until

2.2.10 • Public • Published

Finds key of first entry passing a test. 🏃 📼 📦 🌔 📒

Alternatives: scanWhile, scanUntil.
This is part of package extra-entries.

entries.scanUntil(x, ft);
// x:  entries
// ft: test function (v, k, x)
const entries = require('extra-entries');
 
var x = [['a', 1], ['b', 2], ['c', 3], ['d', 2]];
entries.scanUntil(x, v => v % 2 === 0);
// 'b'                       ^
 
entries.scanUntil(x, v => v % 8 === 0);
// undefined

references

Install

npm i @extra-entries/scan-until

DownloadsWeekly Downloads

33

Version

2.2.10

License

MIT

Unpacked Size

8.28 kB

Total Files

19

Last publish

Collaborators

  • avatar