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

2.0.0 • Public • Published

Build Status npm downloads

multi-sort

NPM

Multidimensional Sort Helper

Installation

With npm:

$ npm i multi-sort

or with yarn:

$ yarn add multi-sort

Usage

import MultiSort from 'multi-sort';

let arr = [
    { first_name: 'John', last_name: 'Doe' },
    { first_name: 'Anthony', last_name: 'Zipher' },
    { first_name: 'Anthony', last_name: 'Carlos' }
];

let sortedByFirstName = MultiSort(arr, 'first_name', 'ASC');

/* Sort by multi params */
let sortedByFirstAndLast = MultiSort(arr, ['first_name', 'last_name'], ['ASC', 'DESC']);
/* or */
let sortedByFirstAndLast = MultiSort(arr, {
    first_name: 'ASC',
    last_name: 'DESC'
});

Readme

Keywords

none

Package Sidebar

Install

npm i multi-sort

Weekly Downloads

467

Version

2.0.0

License

MIT

Unpacked Size

16.1 kB

Total Files

12

Last publish

Collaborators

  • xico2k