Skip to content

minimumEntry

Subhajit Sahu edited this page May 3, 2023 · 1 revision

Find first smallest entry.

Alternatives: minimum, minimumEntry.
Similar: minimum, maximum, range.


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

var x = [1, 2, -3, -4];
xarray.minEntry(x);
// → [ 3, -4 ]

xarray.minEntry(x, (a, b) => Math.abs(a) - Math.abs(b));
// → [ 0, 1 ]

xarray.minEntry(x, null, v => Math.abs(v));
// → [ 0, 1 ]


References

Clone this wiki locally