UNPKG

@extra-array/find-index

Version:

Finds index of leftmost value passing a test.

16 lines (12 loc) 321 B
'use strict'; var extraIterable = require('extra-iterable'); /** * Finds index of leftmost value passing a test. * @param x an array * @param ft test function (v, i, x) * @returns index of value, -1 if not found */ function findIndex(x, ft) { return extraIterable.search(x, ft); } module.exports = findIndex;