Have ideas to improve npm?Join in the discussion! »

    sorti

    1.0.3 • Public • Published

    Sorti!

    Sorti is a small JS Utils library for sorting. { selectionSort, insertionSort, bubbleSort, mergeSort }

    Usage

    const { mergeSort} = require('sorti');
    
    //Simple array with Numbers\Strings
    let unsortedArray = [ 11, 2, 93, 3, 12, 21, 50, 41 ];
    let sortedArray = mergeSort(unsortedArray) // [ 2, 3, 11, 12, 21, 41, 50, 93 ]
    
    //Array of objects - Sort by age attribute, desc.
    let objectsArray = new Array(1000).fill(0).map(item => {
        return { age: parseInt(Math.random() * 100) };
    })
    
    const options = {field: 'age', asc: false}
    let reverseSortedArray = mergeSort(objectsArray, options)
    

    Link

    NPM - Sorti

    Git - Link

    end

    Install

    npm i sorti

    DownloadsWeekly Downloads

    1

    Version

    1.0.3

    License

    ISC

    Unpacked Size

    5.13 kB

    Total Files

    3

    Last publish

    Collaborators

    • avatar