Sorting text with the Hungarian spelling rules.
npm install hunsorter
import sorting from hunsorter;
const fruits = ['narancs', 'alma', 'körte'];
fruits.sort(sorting);
import sorting from hunsorter;
const fruits = ['narancs', 'alma', 'körte'];
fruits.sort((a, b) => sorting(b, a));
import sorting from hunsorter;
const fruits = [
{ name: 'narancs' },
{ name: 'alma' },
{ name: 'körte' }
];
fruits.sort((a, b) => sorting(a.name, b.name));
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));