A common problem with web applications is that sorting results are inconsistent between the front-end and back-end because the browser and server collation tables differ. These differences force a developer to do all sorting either in the front-end or back-end, which is not very good solution. An application should not have to pay a penalty of a network call just to sort and the server should not get pinged for every sort either. A developer should have the ability to select the best solution for a given problem.

Another problem with native JavaScript sorting is that JavaScript defines a character as a 16 bit code unit. Some languages use more than one code point per character, so that makes sorting even more interesting. Also, what if you want to sort using German Phonebook collation not just plain old German, a regional dialect, or incorporate any other collation nuance? What is a developer to do?

Enter lasca.js

Lasca.js sorts arrays, arrays of objects, and compares strings using custom defined collation tables. Out of the box it is loaded with copies the UCA collation tables, but developers are free to define their own collation tables. Lasca.js can sort languages that use more than one 16 bit code unit per character. Lasca.js can run in Node.js, so the front-end and back-end can share the same collation tables and sorting algorithm for those of you running Node.js.

Where Can I get lasca.js?

Lasca.js is available on github: https://github.com/Teradata/lasca

Please fork, fix, and improve until you read in hexadecimal code points.