Installation
Quick Take
Purpose
Take any input: nested array, nested plain object or whatever really, no matter how deeply nested. Walk through it recursively and if you find any plain objects, assign all their keys to a given second input’s argument OR default, false
.
It does not mutate the input arguments. Operations are done on a cloned input.
We needed this library to overwrite all values to be false
on JSON schema objects, so that later when we copy from key/value pairs from schema, values are equal to false
and we don’t need to prep them further.
This library is well-tested and is being used in commercial projects.
API — setAllValuesTo()
The main function setAllValuesTo()
is imported like this:
It’s a function which takes two input arguments:
Input argument | Type | Obligatory | Default | Description |
---|---|---|---|---|
input Type: Plain object Obligatory: yes Default: n/a | ||||
input | Plain object | yes | n/a | JSON-like data structure. |
value Type: Any Obligatory: no Default: boolean false | ||||
value | Any | no | boolean false | Assign all the found plain object values to this |
The function will return a clone of input
with values overwritten (where applicable).
API — version
You can import version
: