@win2win/shared 1.0.146 → 1.0.148
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.
|
@@ -17,4 +17,4 @@ export declare function toCurrency(value: number, symbol?: string, options?: {
|
|
|
17
17
|
* @param options.emptyValues - Array of values that should be ignored when merging objects (default: `undefined`)
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
|
-
export declare function mergeObjects<T extends Record<string, any>>(...args: Record<string, any>[]): Record<string, any>;
|
|
20
|
+
export declare function mergeObjects<T extends Record<string, any>>(...args: (Record<string, any> | undefined | null | '')[]): Record<string, any>;
|
|
@@ -73,7 +73,7 @@ function mergeObjects(...args) {
|
|
|
73
73
|
? args.pop()
|
|
74
74
|
: undefined;
|
|
75
75
|
const emptyValues = [undefined, ...(options?.emptyValues || [])];
|
|
76
|
-
return args.reduce((acc, obj) => {
|
|
76
|
+
return args.filter(Boolean).reduce((acc, obj) => {
|
|
77
77
|
return (0, lodash_1.mergeWith)(acc, obj, (objValue, srcValue) => {
|
|
78
78
|
if (emptyValues.some((v) => srcValue === v))
|
|
79
79
|
return objValue;
|
package/package.json
CHANGED