sort_quick
v1.0.1
Published
qsort
Downloads
2
Maintainers
Readme
Installation:
npm install sort_quick
Usage
const { qsort, qsortObj } = require('sort_quick');
const notSorted = [6, 4, 7, 2, 10, 1];
/* qsort sorts only strings and numbers. You can pass an array and direction (asc or desc) as arguments. */
const sorted = qsort(notSorted);
const objs = [
{
id: 6,
},
{
id: 4,
},
{
id: 7,
},
{
id: 2,
},
{
id: 10,
},
{
id: 1,
},
];
/* To sort complex objects use qsortObj. You can pass an array, direction and sort key as arguments. */
const sortedObjs = qsortObj(objs, true, 'id');