File size: 808 Bytes
4cadbaf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# alphanum-sort
[![Build Status](https://travis-ci.org/TrySound/alphanum-sort.svg?branch=master)](https://travis-ci.org/TrySound/alphanum-sort)

> Alphanumeric sorting algorithm

## Install

With [npm](https://npmjs.org/package/alphanum-sort) do:

```

npm i alphanum-sort -S

```

## Example

```js

var sort = require('alphanum-sort');



var result = sort(['item20', 'item19', 'item1', 'item10', 'item2']);

// ['item1', 'item2', 'item10', 'item19', 'item20']

```

## API

### alphanumSort(array, options)

#### options

##### insensitive

Type: `Boolean`
Default: `false`

Compares items case insensitively

##### sign

Type: `Boolean`
Default: `false`

Allows `+` and `-` characters before numbers

## License

MIT © [Bogdan Chadkin](https://github.com/trysound)