Skip to content

Extension for the JS sort() function to include non-latin alphabets into the sorted results instead of listing each alphabet after one another

License

Notifications You must be signed in to change notification settings

M-L-D-H/unisort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DOI License: GPL v3 GitHub version

uniSort

A simple and expandable extension for JavaScript's sort() method to provide an integrative sorting result that includes non-latin alphabets, instead of just adding them at the end.

Installation

npm install unisort

Usage

import uniSort from 'unisort';

const alphabetUnsorted = ['A','B','ط','D','ا'];
const namesUnsorted = ['Alfred', 'Ben', 'طارق', 'Daniel', 'احمد', 'Yvonne'];

uniSort(alphabetUnsorted) // ['A', 'ا', 'B', 'D', 'ط']
uniSort(namesUnsorted) // ['احمد', 'Alfred', 'Ben', 'Daniel', 'طارق', 'Yvonne']

Supported Languages

1.0.0

  • Arabic

1.1.0

  • Hebrew

Test

npm test

Contribution

Right now, the extension does only include the Arabic and Hebrew alphabet. It is planned to add more non-latin alphabets (e.g. Farsi, Tamazight, Syriac), however, feel free to contribute by adding an alphabet of your choice. Please be sure to also add tests for each alphabet you add. Before committing, please test and lint your code according to AirBnb codestyle.

About

Extension for the JS sort() function to include non-latin alphabets into the sorted results instead of listing each alphabet after one another

Resources

License

Stars

Watchers

Forks

Packages

No packages published