hunsorter
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

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));

Package Sidebar

Install

npm i hunsorter

Weekly Downloads

6

Version

2.1.0

License

MIT

Unpacked Size

62.1 kB

Total Files

23

Last publish

Collaborators

  • janosorcsik