FCF 2.0 development in progress...
> > > >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

Configuration parameter merge

Configuration parameter: merge

Package: fcf-framework-core

Available from version: 2.0.2

Type: object

An object that describes the rules for merging configuration properties from different configuration sources.

The key is a string path of the configuration parameter (name)

The value is either a string containing the path to the global function that performs the merge, or an object with the following structure:

  • string function - Path to the function that performs the parameter merging

  • string file - Path to a file in FCF notation that stores the merge function. This file will be loaded automatically if the function specified in the "function" parameter is not found.

If a merge function is not defined for a configuration parameter, then a simple merge parameter substitution is performed.

The merge function must have the following signature:

mixed function(mixed a_originValue, mixed a_newValue)

  • mixed a_originValue - Copy of current configuration parameter data

  • mixed a_newValue - New configuration parameter data

The function must return the result of merging the configuration parameter.


fcf.getConfiguration().append({ merge: { "container": "fcf.append", "container.array2": "fcf.append", }, container: { array1: [1], array2: [1], } }); fcf.getConfiguration().append({ container: { array1: [2], array2: [2], array3: [2], } }); console.log(fcf.getConfiguration().container);


{ array1: [ 2 ], array2: [ 1, 2 ], array3: [ 2 ] };