@extra-iterable/compare

Compares two iterables.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@extra-iterable/compare
102.5.222 years ago3 years agoMinified + gzip package size for @extra-iterable/compare in KB

Readme

Compares two iterables. :package: :smileycat: :running: :vhs: :moon: :scroll: :newspaper: :bluebook:
Similar: compare, isEqual.

This is part of package extra-iterable.



iterable.compare(x, y, [fc], [fm]);
// x:  an iterable
// y:  another iterable
// fc: compare function (a, b)
// fm: map function (v, i, x)
// → x<y: -1, x=y: 0, x>y: 1

const iterable = require("extra-iterable");

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

var y = [1, 2];
iterable.compare(x, y);
// 0

var y = [1, -2];
iterable.compare(x, y);
// 1

iterable.compare(x, y, (a, b) => Math.abs(a) - Math.abs(b));
// 0

iterable.compare(x, y, null, v => Math.abs(v));
// 0



References