Skip to content

High-performance natural sort. Sorts an array in numerical and alphabetical order in a string.

License

Notifications You must be signed in to change notification settings

Aaron-Bird/legible-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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' ]

About

High-performance natural sort. Sorts an array in numerical and alphabetical order in a string.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published