Removes duplicate values. :running: :vhs: :package: :moon: :ledger:
Alternatives: compare, map.
This is part of package extra-iterable.
This is browserified, minified version of @extra-iterable/unique-on.
It is exported as global variable iterableuniqueOn.
CDN: unpkg, jsDelivr.
iterable.uniqueOn(x, [fn], [ths]);
// x: an iterable
// fn: map function (v, i, x)
// ths: this argument
const iterable = require('extra-iterable');
var x = [1, 2, 3, 4, 2, 3];
[...iterable.uniqueOn(x)];
// [ 1, 2, 3, 4 ]
var x = [1, 2, 3, 4, -2, -3];
[...iterable.uniqueOn(x, v => Math.abs(v))];
// [ 1, 2, 3, 4 ]