Function getWidgetConfig

Returns a configuration object from the given user input, which can be either an object or a <separator> separated string of key=values.

If input is a string, it must be of the format:

<UserConfigString> ::= <OptionSpec> { <Separator> <OptionSpec> }

<OptionSpec> ::=
<BooleanOptionName> [ "=" ( "false" | "true" ) ] |
<OptionName> "=" <OptionValue>

By default, for widgets <separator> is "|".

NOTE: If input is a string, option names will be converted from kebab-case to camelCase.

The given validator defines the shape of the returned object. It is called for each entry in the validator object, with that key and the corresponding value from the input configuration, as the two parameters.

If a key is not found in the input, the value passed to the validating function will be undefined.

If the input is a string and a key has no value, the value passed to the validating function will be an empty string "".

The final configuration contains all keys from the validator object with the value that the validating function for each key returned.

There are several built-in validating functions that you can make use of.