sortifyjs
v1.0.4
Published
Package to sort your javascript or typescript code
Downloads
6
Readme
SortifyJS
sortifyjs
sorts object keys alphabetically into new array.
Install as an NPM module
$ npm install sortifyjs
Usage
import { createSort } from 'sortifyjs'
or
const { createSort } = require('sortifyjs');
How to use
Basic
interface DataType {
year: number;
name: string;
}
const data: DataType[] = [
{
year: 25,
name: "Ana"
},
{
year: 50,
name: "Thomas"
},
{
year: 18,
name: "Louise"
},
{
year: 20,
name: "Alex"
},
]
createSort<DataType[]>({
data: data,
sortBy: "year",
order: "DESC"
})
Output
[
{
year: 50,
name: "Thomas"
},
{
year: 25,
name: "Ana"
},
{
year: 20,
name: "Alex"
},
{
year: 18,
name: "Louise"
},
]