1.1.0 • Published 2 years ago

boosted-sorter v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

boosted-sorter

version downloads MIT License

Getting Started

Install with NPM:

$ npm install boosted-sorter --save

Usage

import boostedSorter from "boosted-sorter";

const users = [
    {
        email: "admin@company.com",
        password: "admin",
        username: "admin",
    },
    {
        email: "leslie.vasquez65@company.com",
        password: "funfun",
        username: "bluepanda840",
    },
    {
        email: "john.doe@company.com",
        password: "jdoe",
        username: "jdoe",
    },
    {
        email: "yolanda.bishop25@company.com",
        password: "personal",
        username: "purplewolf498",
    },
    {
        email: "allen.hansen47@company.com",
        password: "jenny1",
        username: "whitecat698",
    },
];

boostedSorter({
    data: users,
    properties: ["username"],
    type: "string",
    orderBy: "asc",
});

/*
[
    {
        email: "admin@company.com",
        password: "admin",
        username: "admin",
    },
    {
        email: "leslie.vasquez65@company.com",
        password: "funfun",
        username: "bluepanda840",
    },
    {
        email: "john.doe@company.com",
        password: "jdoe",
        username: "jdoe",
    },
    {
        email: "yolanda.bishop25@company.com",
        password: "personal",
        username: "purplewolf498",
    },
    {
        email: "allen.hansen47@company.com",
        password: "jenny1",
        username: "whitecat698",
    },
];
*/

Options

boostedSorter({
    data: [], // The array of objects to sort
    properties: [], // Object properties to sort
    type: "stringWithNumber", // enum('stringWithNumber'|'string'|'number'|'dateTime'), by default 'stringWithNumber'
    orderBy: "asc", // enum('asc'|'desc'), by default 'asc'
});

License

Released under the MIT License.