@extra-set/scan-until.min

Finds first value passing a test. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraSetScanUntilMin from 'https://cdn.skypack.dev/@extra-set/scan-until.min';
</script>

README

Finds first value passing a test. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: scanWhile, scanUntil.

This is part of package extra-set.

This is browserified, minified version of @extra-set/scan-until.
It is exported as global variable set_scanUntil.
CDN: unpkg, jsDelivr.


set.scanUntil(x, ft);
// x:  a set
// ft: test function (v, v, x)
const set = require("extra-set");

var x = new Set([1, 2, 3, 4]);
set.scanUntil(x, v => v % 2 === 0);
// 2                ^

set.scanUntil(x, v => v % 8 === 0);
// undefined


References