2.1.3 • Published 10 months ago

@mategyerek/hunsorter v2.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

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

10 months ago

2.1.2

10 months ago

2.1.1

10 months ago

2.1.0

10 months ago