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

2.9.2 • Public • Published

Finds index of smallest value. 🏃 📼 📦 🌔 📒

Alternatives: min, minIndex.
Similar: min, max, range.
This is part of package extra-array.

array.minIndex(x, [fc], [fm]);
// x:  an array
// fc: compare function (a, b)
// fm: map function (v, i, x)
const array = require('extra-array');

var x = [1, 2, -3, -4];
array.minIndex(x);
// 3                ^

array.minIndex(x, (a, b) => Math.abs(a) - Math.abs(b));
// 0     ^

array.minIndex(x, null, v => Math.abs(v));
// 0     ^

references

Package Sidebar

Install

npm i @extra-array/min-index

Weekly Downloads

2

Version

2.9.2

License

MIT

Unpacked Size

6.8 kB

Total Files

14

Last publish

Collaborators

  • wolfram77