1 | # Compary [![Travic CI](https://travis-ci.org/winterbe/compary.svg?branch=master)](https://travis-ci.org/winterbe/compary)
|
2 |
|
3 | > A library for composing complex compare-functions.
|
4 |
|
5 | ```js
|
6 | persons.sort(
|
7 | compareBy(p => p.lastName)
|
8 | .thenBy(p => p.firstName)
|
9 | );
|
10 | ```
|
11 |
|
12 | ---
|
13 |
|
14 | <p align="center">
|
15 | <strong>★★★ Like this project? <a href="https://github.com/winterbe/compary/stargazers">Leave a star</a> and <a href="https://twitter.com/winterbe_">feedback on Twitter</a>! Thanks. ★★★</strong>
|
16 | </p>
|
17 |
|
18 | ---
|
19 |
|
20 | ## Getting started
|
21 |
|
22 | Download the [latest release](https://github.com/winterbe/compary/releases) from GitHub or install Compary from [NPM](https://www.npmjs.com/package/compary):
|
23 |
|
24 | ```bash
|
25 | npm install --save compary
|
26 | ```
|
27 |
|
28 | Alternatively use Compary from [CDN](https://unpkg.com/compary/) by adding this to your HTML:
|
29 |
|
30 | ```html
|
31 | <script src="https://unpkg.com/compary"></script>
|
32 | ```
|
33 |
|
34 | ## License
|
35 |
|
36 | MIT © [Benjamin Winterberg](https://twitter.com/winterbe_)
|