legible-sort
v1.0.0-alpha.1
Published
High-performance natural sort. Sorts an array in numerical and alphabetical order in a string. Make the order more consistent with human reading habits. For large amounts of data and performance requirements.
Downloads
2
Maintainers
Readme
legible-sort
High-performance natural sort.
Sorts an array in numerical and alphabetical order in a string.
Make the order more consistent with human reading habits.
For large amounts of data and performance requirements.
["20.txt", "10.txt", "2.txt", "1.txt"]
->
[ "1.txt", "2.txt", "10.txt", "20.txt" ]
["b1.txt", "B1.txt", "a1.txt", "A1.txt"]
->
[ "A1.txt", "a1.txt", "B1.txt", "b1.txt" ]
Features
- Natural sort
- No dependency
- High performance
- Easy to use
Installation
npm:
npm install legible-sort --save
yarn:
yarn add legible-sort
Usage
const legibleSort = require("legible-sort");
const list = ["20.txt", "10.txt", "2.txt", "1.txt"];
legibleSort(list);
console.log(list); // [ '1.txt', '2.txt', '10.txt', '20.txt' ]