Global

Methods

(async) combine(root, optionsopt) → {object}

It looks into the path: * For every JSON file it finds, it creates a key with the file name (without the `.json` extension) The value will be the contents of the file parsed in JSON. * For every directory, it creates a key with the file name. The value will be created by calling the `combine()` function recursively on the subdirectory.
Parameters:
Name Type Attributes Description
root string The path to a folder that contains the files and subdirectories
options object <optional>
options for customizing the behavior of the algorithm
Properties
Name Type Attributes Default Description
parser function <optional>
JSON.parse a custom parser that receives the contents of the file as the only argument and returns the parsed value. The `parser` function can even be `async` (returning a promise)
include string <optional>
'*.json' a glob pattern for what to include
exclude string <optional>
a glob pattern for what to exclude
Source:
Throws:
An error if it can't access or parse a file or directory.
Returns:
A JavaScript object (or an array if that's what the data represents).
Type
object
Examples
If you want to use `json5` pass `JSON5.parse`.
If you use `js-yaml`, pass `jsYaml.safeLoad`.
If you use `ini`, pass `ini.parse`.