Skip to content

Commit

Permalink
Add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluefire2 committed Jun 3, 2018
1 parent 3914106 commit 272cac2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Sort unique [![Build Status](https://travis-ci.org/Bluefire2/sort-unique.svg?branch=master)](https://travis-ci.org/Bluefire2/sort-unique) [![Coverage Status](https://coveralls.io/repos/github/Bluefire2/sort-unique/badge.svg?branch=master)](https://coveralls.io/github/Bluefire2/sort-unique?branch=master)

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
```javascript
(a, b) => {
if (a > b) {
return 1;
} else if (a < b) {
return -1;
} else {
return 0;
}
};
```

0 comments on commit 272cac2

Please sign in to comment.