@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.
27 lines (24 loc) • 699 B
JavaScript
;
function setValueByPath(obj, pathArr, value) {
if (pathArr.length === 0) {
Object.assign(obj, value);
return false;
}
if (pathArr.length === 1) {
var key_1 = pathArr[0];
if (obj && typeof obj === 'object') {
obj[key_1] = value;
return true;
}
return false;
}
var key = pathArr[0], restPath = pathArr.slice(1);
if (obj && typeof obj === 'object' && Object.prototype.hasOwnProperty.call(obj, key)) {
return setValueByPath(obj[key], restPath, value);
}
else {
return false;
}
}
exports.setValueByPath = setValueByPath;
//# sourceMappingURL=setValueByPath.js.map