Class: Onion

Onion()

new Onion()

Source:

Members

layers :Array.<AbstractLayer>

Type:
Source:

Methods

(async) addLayer(layer) → {Promise.<void>}

Adds layer to storage for further data search

Parameters:
Name Type Description
layer AbstractLayer
Source:
Returns:
Type
Promise.<void>

compile()

Compile config and prepare it for .get()

Source:

get(path, separatoropt) → {*}

Search data by path in merged data, if data is not merged yet, will merge and returns
then returns value or error

Parameters:
Name Type Attributes Description
path string

Path to target value

separator string <optional>

Path separator, default is set as options.getSeparator, which default is dot

Source:
Returns:
Type
*

recompile()

Build inner config cache again, can be used for manual runtime layers re-read

Source:

Onion(optionsopt)

new Onion(optionsopt)

Parameters:
Name Type Attributes Description
options object <optional>
Properties
Name Type Attributes Description
getSeparator string <optional>

Default separator for .get method

mergeMethod function <optional>

Custom layers merge method: function (target, ...args) where target - object

links boolean <optional>

Allow config links: '@<path.with.separators>'

ignoreWrongLinks boolean <optional>

Ignore wrong links
to merge to, args - patches, that will be applied in the order of appearance

Source:

Members

layers :Array.<AbstractLayer>

Type:
Source:

Methods

(async) addLayer(layer) → {Promise.<void>}

Adds layer to storage for further data search

Parameters:
Name Type Description
layer AbstractLayer
Source:
Returns:
Type
Promise.<void>

compile()

Compile config and prepare it for .get()

Source:

get(path, separatoropt) → {*}

Search data by path in merged data, if data is not merged yet, will merge and returns
then returns value or error

Parameters:
Name Type Attributes Description
path string

Path to target value

separator string <optional>

Path separator, default is set as options.getSeparator, which default is dot

Source:
Returns:
Type
*

recompile()

Build inner config cache again, can be used for manual runtime layers re-read

Source: