-
Notifications
You must be signed in to change notification settings - Fork 5
isUnique
wolfram77 edited this page Mar 19, 2020
·
22 revisions
Checks if there are no duplicate values.
array.isUnique(x, [fn]);
// x: an array
// fn: compare function (a, b)
// --> true if no duplicates
const array = require('extra-array');
var x = [1, 2, -1, -2];
array.isUnique(x);
// true
array.isUnique(x, (a, b) => Math.abs(a) - Math.abs(b));
// false