Installation
Quick Take
Purpose
Recursively traverse the deeply-cloned input and merge all plain objects within each array.
API — flattenAllArrays()
The main function flattenAllArrays()
is imported like this:
It’s a function which takes three input arguments:
Input argument | Type | Obligatory | Description |
---|---|---|---|
input Type: Plain object Obligatory: yes | |||
input | Plain object | yes | Plain object to work with. |
options Type: Plain object Obligatory: no | |||
options | Plain object | no | Optional Options Object. |
The Optional Options Object has the following shape:
Key | Type | Default | Description |
---|---|---|---|
flattenArraysContainingStringsToBeEmpty Type: Boolean Default: false | |||
flattenArraysContainingStringsToBeEmpty | Boolean | false | If any arrays contain strings, flatten them to be empty thing. This is turned off by default, but it’s what you actually need most of the time. |
Here are all defaults in one place for copying:
The function will return a clone of the input object, with all arrays flattened.
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
: