Nothing's plumb meaningless
    Have ideas to improve npm?Join in the discussion! »

    @justbe-utilities/array-sort
    TypeScript icon, indicating that this package has built-in type declarations

    1.3.4 • Public • Published

    Array Sort

    Basic array sort using underscore.js, require underscore

    Dependencies (no need to install mannually)

    This package depends upon underscore@1.8.3

    npm i underscore@1.8.3 --save
    

    install types @types/underscore@1.8.3 if you are using typescript

    npm i @types/underscore@1.8.3 --save-dev
    

    Installation

    Use the node package manager npm to install @justbe-utilities/array-sort.

    npm install @justbe-utilities/array-sort --save

    Usage

    ...
    import { ArraySortClass } from '@justbe-utilities/array-sort'
    ...
    constructor(){
        let sortedArray = ArraySortClass.sort(this.recentLocations, 'cO', 'desc');
        //argument1 => array to be sorted
        //argument2 => key on which you want to sort
        //argument3 => order in which you want to sort array
            //supported orders => 'desc' | 'asc'
            //by default => 'asc'
    }

    Example

    ...
    let array = [
        {cO:1},
        {cO:5},
        {cO:3},
        {cO:6},
    ];
    let sortedArray = ArraySortClass.sort(array, 'cO', 'desc');
    console.log(sortedArray);
    // output
    // {cO:6},
    // {cO:5},
    // {cO:3},
    // {cO:1},
     
    let sortedArray = ArraySortClass.sort(array, 'cO', 'asc');
    console.log(sortedArray);
    // output
    // {cO:1},
    // {cO:3},
    // {cO:5},
    // {cO:6},
    ...

    License

    MIT

    Keywords

    none

    Install

    npm i @justbe-utilities/array-sort

    DownloadsWeekly Downloads

    7

    Version

    1.3.4

    License

    ISC

    Unpacked Size

    25 kB

    Total Files

    20

    Last publish

    Collaborators

    • avatar
    • avatar