hunsorter
v2.1.0
Published
Sorting text with the Hungarian spelling rules
Downloads
18
Readme
hunsorter
Sorting text with the Hungarian spelling rules.
Installation
npm install hunsorter
How to use
Simple sorting (ascending)
import sorting from hunsorter;
const fruits = ['narancs', 'alma', 'körte'];
fruits.sort(sorting);
Simple sorting (descending)
import sorting from hunsorter;
const fruits = ['narancs', 'alma', 'körte'];
fruits.sort((a, b) => sorting(b, a));
Sorting with key
import sorting from hunsorter;
const fruits = [{ name: 'narancs' }, { name: 'alma' }, { name: 'körte' }];
fruits.sort((a, b) => sorting(a.name, b.name));
Sorting with multiple keys
import sorting from hunsorter;
const fruits = [
{ name: 'narancs', color: 'sárga' },
{ name: 'alma', color: 'piros' },
{ name: 'körte', color: 'sárga' },
];
fruits.sort((a, b) => sorting(a.color, b.color) || sorting(a.name, b.name));