@extra-lists/min

Finds smallest entry. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraListsMin from 'https://cdn.skypack.dev/@extra-lists/min';
</script>

README

Finds smallest entry. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Similar: min, max, range.

This is part of package extra-lists.


lists.min(x, [fc], [fm]);
// x:  lists
// fc: compare function (a, b)
// fm: map function (v, k, x)
// → [key, value]
const lists = require('extra-lists');

var x = [['a', 'b', 'c', 'd'], [1, 2, -3, -4]];
lists.min(x);
// [ 'd', -4 ]

lists.min(x, (a, b) => Math.abs(a) - Math.abs(b));
// [ 'a', 1 ]

lists.min(x, null, v => Math.abs(v));
// [ 'a', 1 ]


References