Alternatives: compare, map.
This is part of package extra-array.
array.minOn(x, [fn], [ths]);
// x: an array
// fn: map function (v, i, x)
// ths: this argument
const array = require('extra-array');
var x = [1, 2, -3, -4];
array.minOn(x);
// -4
array.minOn(x, v => Math.abs(v));
// 1