@extra-array/find-index
TypeScript icon, indicating that this package has built-in type declarations

2.9.12 • Public • Published

Finds index of leftmost value passing a test. 🏃 📼 📦 🌔 📒

Alternatives: findIndex, findIndices.
Similar: find, findIndex.
This is part of package extra-array.

array.findIndex(x, fn);
// x:  an array
// fn: test function (v, i, x)
// --> index of value, -1 if not found
const array = require('extra-array');

var x = [1, 2, 3, 4, 5];
array.findIndex(x, v => v % 2 == 0);
// 1        ^

array.findIndex(x, v => v % 2 == 1);
// 0     ^

references

/@extra-array/find-index/

    Package Sidebar

    Install

    npm i @extra-array/find-index

    Weekly Downloads

    182

    Version

    2.9.12

    License

    MIT

    Unpacked Size

    6.78 kB

    Total Files

    14

    Last publish

    Collaborators

    • wolfram77