array-findindexof

Get index of first value in array that satisfies the test, like Array.findIndex().

Usage no npm install needed!

<script type="module">
  import arrayFindindexof from 'https://cdn.skypack.dev/array-findindexof';
</script>

README

array-findindexof

NOTE: array-findindexof was renamed to @extra-array/find-index. NPM

Get index of first value in array that satisfies the test, like Array.findIndex().

const findIndexOf = require('array-findindexof');
// findIndexOf(<array>, <test function>, [this], [begin=0], [end])
// - <test function>(<value>, <index>, <array>)

findIndexOf(['A', 'B'], (v) => v>'A');
// 1
findIndexOf('abc', (v, i, arr) => v>'b', null, 1);
// 2
findIndexOf('abc', (v, i, arr) => v>'b', null, 1, 2);
// -1