compare - nodef/extra-iterable GitHub Wiki
Compare two iterables.
function compare(x, y, fc, fm)
// x: an iterable
// y: another iterable
// fc: compare function (a, b)
// fm: map function (v, i, x)
const xiterable = require('extra-iterable');
var x = [1, 2];
var y = [1, 2, 3];
xiterable.compare(x, y);
// -1
var y = [1, 2];
xiterable.compare(x, y);
// 0
var y = [1, -2];
xiterable.compare(x, y);
// 1
xiterable.compare(x, y, (a, b) => Math.abs(a) - Math.abs(b));
// 0
xiterable.compare(x, y, null, v => Math.abs(v));
// 0