1.0.4 • Published 4 years ago

@drcyph3r/dynamic-sort v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Dynamic Sort

Build Status

Fast and easy way to sort an array of objects based on a property with typescript support.

Installation

npm i @drcyph3r/dynamic-sort
yarn add @drcyph3r/dynamic-sort

Usage

import dynamicsort from '@drcyph3r/dynamic-sort'

let fruits = [
  {
    id: 1,
    name: 'Apple'
  },
  {
    id: 2,
    name: 'Orange'
  }
]

// sort the fruits array by id in ascending order
const sortedArr = fruits.sort(dynamicsort('id', 'asc'))

Props

PropValue
propertykey of a json object
orderasc, desc

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago