You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
808 B

4 years ago
  1. # alphanum-sort
  2. [![Build Status](https://travis-ci.org/TrySound/alphanum-sort.svg?branch=master)](https://travis-ci.org/TrySound/alphanum-sort)
  3. > Alphanumeric sorting algorithm
  4. ## Install
  5. With [npm](https://npmjs.org/package/alphanum-sort) do:
  6. ```
  7. npm i alphanum-sort -S
  8. ```
  9. ## Example
  10. ```js
  11. var sort = require('alphanum-sort');
  12. var result = sort(['item20', 'item19', 'item1', 'item10', 'item2']);
  13. // ['item1', 'item2', 'item10', 'item19', 'item20']
  14. ```
  15. ## API
  16. ### alphanumSort(array, options)
  17. #### options
  18. ##### insensitive
  19. Type: `Boolean`
  20. Default: `false`
  21. Compares items case insensitively
  22. ##### sign
  23. Type: `Boolean`
  24. Default: `false`
  25. Allows `+` and `-` characters before numbers
  26. ## License
  27. MIT © [Bogdan Chadkin](https://github.com/trysound)