1.0.0 • Published 6 years ago
sort-unique v1.0.0
Sort unique
Sort unique is a package that sorts an array and removes all duplicate elements (without modifying the original array).
Installation
You can download and install this package from NPM with npm i -S sort-unique
.
require('sort-unique')(array[, compare])
Sorts an array and removes all duplicates.
array
: the array to processcompare
: a function that compares two items in the array, returning1
for greater than,0
for equal, and-1
for less than.
If compare
is unspecified, it will default to
(a, b) => {
if (a > b) {
return 1;
} else if (a < b) {
return -1;
} else {
return 0;
}
};
1.0.0
6 years ago