Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
763 bytes
|
Line | |
---|
1 | # alphanum-sort
|
---|
2 | [![Build Status](https://travis-ci.org/TrySound/alphanum-sort.svg?branch=master)](https://travis-ci.org/TrySound/alphanum-sort)
|
---|
3 |
|
---|
4 | > Alphanumeric sorting algorithm
|
---|
5 |
|
---|
6 | ## Install
|
---|
7 |
|
---|
8 | With [npm](https://npmjs.org/package/alphanum-sort) do:
|
---|
9 |
|
---|
10 | ```
|
---|
11 | npm i alphanum-sort -S
|
---|
12 | ```
|
---|
13 |
|
---|
14 | ## Example
|
---|
15 |
|
---|
16 | ```js
|
---|
17 | var sort = require('alphanum-sort');
|
---|
18 |
|
---|
19 | var result = sort(['item20', 'item19', 'item1', 'item10', 'item2']);
|
---|
20 | // ['item1', 'item2', 'item10', 'item19', 'item20']
|
---|
21 | ```
|
---|
22 |
|
---|
23 | ## API
|
---|
24 |
|
---|
25 | ### alphanumSort(array, options)
|
---|
26 |
|
---|
27 | #### options
|
---|
28 |
|
---|
29 | ##### insensitive
|
---|
30 |
|
---|
31 | Type: `Boolean`
|
---|
32 | Default: `false`
|
---|
33 |
|
---|
34 | Compares items case insensitively
|
---|
35 |
|
---|
36 | ##### sign
|
---|
37 |
|
---|
38 | Type: `Boolean`
|
---|
39 | Default: `false`
|
---|
40 |
|
---|
41 | Allows `+` and `-` characters before numbers
|
---|
42 |
|
---|
43 | ## License
|
---|
44 |
|
---|
45 | MIT © [Bogdan Chadkin](https://github.com/trysound)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.