We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Find first index of a value.
Alternatives: searchValue, searchValueRight, searchValueAll. Similar: values, hasValue, searchValue. Similar: search, [scan], find.
function searchValue(x, v, fc, fm) // x: an iterable // v: search value // fc: compare function (a, b) // fm: map function (v, i, x)
const xiterable = require('extra-iterable'); var x = [1, 2, 3, 2, 5]; xiterable.searchValue(x, 2); // → 1 ^ var x = [1, -2, 3, 2, 5]; xiterable.searchValue(x, 2, (a, b) => Math.abs(a) - Math.abs(b)); // → 1 ^ var x = [1, -2, 3, 2, 5]; xiterable.searchValue(x, 2, null, v => Math.abs(v)); // → 1 ^