1.0.0 • Published 6 years ago

sort-unique v1.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

Sort unique Build Status Coverage Status

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 process
  • compare: a function that compares two items in the array, returning 1 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