multiple-array-sorter

    1.1.0 • Public • Published

    Functions

    checkLengths(...arrays)boolean

    Checks if all arrays are the same size

    getMoveMap(arrayToSortBy, sortParams)Object

    Sorts master array and returns moveMap

    sortArrayBasedOnMoveMap(array, moveMap)Array.<any>

    Sorts array based on moveMap

    sortMultipleArrays(arrayToSortBy, sortParams, arraysToSort)SortResult

    Sorts multiple arrays based on master array sort order

    Typedefs

    SortParams
    SortResult
    MoveMapItem

    checkLengths(...arrays) ⇒ boolean

    Checks if all arrays are the same size

    Kind: global function

    Param Type Description
    ...arrays Array.<Array.<any>> Arrays to check length of

    getMoveMap(arrayToSortBy, sortParams) ⇒ Object

    Sorts master array and returns moveMap

    Kind: global function

    Param Type
    arrayToSortBy Array.<any>
    sortParams SortParams

    sortArrayBasedOnMoveMap(array, moveMap) ⇒ Array.<any>

    Sorts array based on moveMap

    Kind: global function

    Param Type
    array Array.<any>
    moveMap Array.<MoveMapItem>

    sortMultipleArrays(arrayToSortBy, sortParams, arraysToSort) ⇒ SortResult

    Sorts multiple arrays based on master array sort order

    Kind: global function
    Returns: SortResult - The sorted master array and the sorted resulting arrays

    Param Type Description
    arrayToSortBy Array.<any> Master array to sort the others arrays by
    sortParams SortParams Parameters to sort master array
    arraysToSort Array.<Array.<any>> Arrays to sort

    SortParams

    Kind: global typedef
    Properties

    Name Type Default Description
    [sortProp] string Property to sort by, if value to sort by is object. Supports nested props, like 'propA.propB'
    [sortOrder] 'asc' | 'desc' "desc" Whether to use ascending or descending order to sort

    SortResult

    Kind: global typedef
    Properties

    Name Type
    masterArray Array.<any>
    sortedArrays Array.<Array.<any>>

    MoveMapItem

    Kind: global typedef
    Properties

    Name Type
    from number
    to number

    Install

    npm i multiple-array-sorter

    DownloadsWeekly Downloads

    15

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    19.2 kB

    Total Files

    10

    Last publish

    Collaborators

    • alrico88