Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@extra-map/scan-until

2.2.6 • Public • Published

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

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

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

references

Install

npm i @extra-map/scan-until

DownloadsWeekly Downloads

0

Version

2.2.6

License

MIT

Unpacked Size

8.37 kB

Total Files

19

Last publish

Collaborators

  • avatar