@artaio/arta-browser
Advanced tools
Comparing version 2.16.0 to 2.16.1
@@ -47,3 +47,3 @@ "use strict"; | ||
var getFullEstimateConfig = function (artaConfig, estimateConfig) { | ||
var finalConfig = (0, helper_1.nestedObjectAssign)((0, helper_1.deepClone)(exports.defaultEstimateConfig), artaConfig, estimateConfig); | ||
var finalConfig = (0, helper_1.nestedObjectAssign)((0, helper_1.deepClone)(exports.defaultEstimateConfig), artaConfig, (0, helper_1.deepClean)(estimateConfig)); | ||
(0, helper_1.applySmallMobileStyling)(finalConfig); | ||
@@ -50,0 +50,0 @@ return finalConfig; |
@@ -63,3 +63,4 @@ import { DestinationFullTextConfig } from './components/Destination'; | ||
} : T; | ||
export declare function deepClean<T extends object>(obj?: T): T | undefined; | ||
export declare function nestedObjectAssign(target: any, ...sources: any[]): any; | ||
export declare function deepClone<T>(obj: T): T; |
@@ -17,2 +17,3 @@ "use strict"; | ||
exports.applySmallMobileStyling = applySmallMobileStyling; | ||
exports.deepClean = deepClean; | ||
exports.nestedObjectAssign = nestedObjectAssign; | ||
@@ -136,2 +137,24 @@ exports.deepClone = deepClone; | ||
} | ||
function deepClean(obj) { | ||
if (typeof obj !== 'object' || obj === null) { | ||
return obj; | ||
} | ||
var cleanedObj = Object.entries(obj).reduce(function (acc, _a) { | ||
var key = _a[0], value = _a[1]; | ||
if (value === null || value === undefined) { | ||
return acc; | ||
} | ||
if (typeof value === 'object' && !Array.isArray(value)) { | ||
var cleanedValue = deepClean(value); | ||
if (Object.keys(cleanedValue).length > 0) { | ||
acc[key] = cleanedValue; | ||
} | ||
} | ||
else { | ||
acc[key] = value; | ||
} | ||
return acc; | ||
}, {}); | ||
return cleanedObj; | ||
} | ||
function nestedObjectAssign(target) { | ||
@@ -138,0 +161,0 @@ var sources = []; |
@@ -177,3 +177,3 @@ "use strict"; | ||
var _a, _b, _c; | ||
var merged = (0, helper_1.nestedObjectAssign)((0, helper_1.deepClone)(exports.defaultTrackingConfig), artaConfig, trackingConfig); | ||
var merged = (0, helper_1.nestedObjectAssign)((0, helper_1.deepClone)(exports.defaultTrackingConfig), artaConfig, (0, helper_1.deepClean)(trackingConfig)); | ||
// Do not merge the default formatOptions: { dateStyle: 'medium' }, as it will override | ||
@@ -180,0 +180,0 @@ // the object property if none is passed which can lead to formatLocaleString to throw |
{ | ||
"name": "@artaio/arta-browser", | ||
"version": "2.16.0", | ||
"version": "2.16.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "source": "lib/index.ts", |
Sorry, the diff of this file is too big to display
461529
6256