array-findin

Get first value in array that satisfies the test, like Array.find().

Usage no npm install needed!

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

README

array-findin

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

Get first value in array that satisfies the test, like Array.find().

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

findIn(['a', 'b', 'cd'], (v) => v>'b');
// 'cd'
findIn(['a', 'b', 'cd'], (v, i, arr) => v>'b', null, 1);
// 'cd'
findIn(['a', 'b', 'cd'], (v, i, arr) => v>'b', null, 1, 2);
// undefined