multiple-array-sorter
v1.1.0
Published
Sort multpile arrays at once according to master sort
Downloads
3
Readme
Functions
Typedefs
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 |