This package has been deprecated

Author message:

Deprecated in favour of fast-sort

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

1.0.1 • Public • Published

Sort anything 🗃 (Archived)

This (short-lived) library was merely an experiment. It's currently archived in favour of snovakovic/fast-sort. His sorting library is easy to use, supports typescript and is blazing fast!

npm i sort-anything

Sort arrays in a functional programming way. A simple & small integration.

Motivation

I wanted to create a way to sort arrays that's close to "functional programming" and has a TINY footprint!

Meet the family

Usage

Sorting on a single prop:

import { sort } from 'sort-anything'
 
const array = [{ id: 3 }, { id: 1 }, { id: 2 }]
 
sort(array).by('id', 'asc') === [{ id: 1 }, { id: 2 }, { id: 3 }]

Sorting on multiple props:

import { sort } from 'sort-anything'
 
const array = [
  { id: 3, tag: 'a' },
  { id: 1, tag: 'b' },
  { id: 1, tag: 'a' },
  { id: 2, tag: 'a' },
]
 
sort(array).by(['id', 'asc'], ['tag', 'asc']) ===
  [
    { id: 1, tag: 'a' },
    { id: 1, tag: 'b' },
    { id: 2, tag: 'a' },
    { id: 3, tag: 'a' },
  ]

Readme

Keywords

Package Sidebar

Install

npm i sort-anything

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

21 kB

Total Files

14

Last publish

Collaborators

  • mesqueeb