@antv/t8
Version:
T8 is a text visualization solution for unstructured data within the AntV technology stack, and it is a declarative JSON Schema syntax that can be used to describe the content of data interpretation reports.
25 lines (21 loc) • 1.14 kB
JavaScript
;
var tslib = require('tslib');
/**
* Helper function to merge default and custom descriptor properties.
*
* Creates a new descriptor that combines properties from both input descriptors,
* with special handling for the encoding object to ensure deep merging.
*
* @param defaultDescriptor - The base descriptor with default properties
* @param customDescriptor - The custom descriptor with overriding properties
* @returns A merged descriptor combining both inputs
*/
function getMergedDescriptor(defaultDescriptor, customDescriptor) {
// Shallow merge of top-level properties
var result = tslib.__assign(tslib.__assign({}, defaultDescriptor), customDescriptor);
// Deep merge of encoding objects from both descriptors
result.style = tslib.__assign(tslib.__assign({}, ((defaultDescriptor === null || defaultDescriptor === void 0 ? void 0 : defaultDescriptor.style) || {})), ((customDescriptor === null || customDescriptor === void 0 ? void 0 : customDescriptor.style) || {}));
return result;
}
exports.getMergedDescriptor = getMergedDescriptor;
//# sourceMappingURL=getMergedDescriptor.js.map