Skip to content
Subhajit Sahu edited this page May 11, 2020 · 27 revisions

Finds smallest value. 🏃 📼 📦 🌔 📒

Alternatives: compare, map.

iterable.min(x, [fn]);
// x:  an iterable
// fn: compare function (a, b)
const iterable = require('extra-iterable');

var x = [1, 2, -3, -4];
iterable.min(x);
// -4

iterable.min(x, (a, b) => Math.abs(a) - Math.abs(b));
// 1

references

Clone this wiki locally