@aemforms/af-core 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,7 +22,7 @@ export declare const addTranslationId: (input: formElementJson, additionalTransl
|
|
|
22
22
|
* @param key key to return from input object (key could be comma separated, example, label.value)
|
|
23
23
|
* @param defaultValue default value
|
|
24
24
|
*/
|
|
25
|
-
export declare const getOrElse: (input: any, key: string, defaultValue?: any) => any;
|
|
25
|
+
export declare const getOrElse: (input: any, key: string | string[], defaultValue?: any) => any;
|
|
26
26
|
/**
|
|
27
27
|
* @param input
|
|
28
28
|
* @param additionalTranslationProps
|
|
@@ -131,7 +131,7 @@ const getOrElse = (input, key, defaultValue = null) => {
|
|
|
131
131
|
if (!key) {
|
|
132
132
|
return defaultValue;
|
|
133
133
|
}
|
|
134
|
-
const arr = key.split('.');
|
|
134
|
+
const arr = Array.isArray(key) ? key : key.split('.');
|
|
135
135
|
let objValue = input, index = 0;
|
|
136
136
|
while (index < arr.length && objValue.hasOwnProperty(arr[index])) {
|
|
137
137
|
objValue = objValue[arr[index]];
|