Installation
Quick Take
API - rSort()
The main function rSort()
is imported like this:
It's a function which takes two input arguments:
Input argument | Type | Obligatory? | Description |
---|---|---|---|
arrOfRanges | Array or null | yes | Input ranges. |
opts | Plain object | no | Optional Options Object. |
None of the input arguments will be mutated by this program, we have unit tests to prove that.
The Optional Options Object has the following shape:
options object's key | Type | Obligatory? | Default | Description |
---|---|---|---|---|
strictlyTwoElementsInRangeArrays | Boolean | no | false | If set to true , all ranges must have two and only elements, otherwise error is thrown. For example, input being [ [1, 2, 'zzz'] ] would throw (3 elements), as well as [ ['a'] ] (1 element). |
progressFn | Function | no | null | If a function is given, it will be called with natural number meaning percentage of the total work done. It's approximate and used in worker setups. |
Here are all defaults in one place for copying:
The function will return sorted ranges array (or null
if that was passed).
API - defaults
You can import defaults
:
It's a plain object:
The main function calculates the options to be used by merging the options you passed with these defaults.
API - version
You can import version
: