@synergy-design-system/components
Version:
38 lines (36 loc) • 1.11 kB
JavaScript
// src/components/chart/themes/utilities.ts
var getRealStyleValue = (token) => {
const computedStyles = getComputedStyle(document.body);
const value = computedStyles.getPropertyValue(token).trim();
return value || "";
};
var getRealValueWithoutUnit = (token) => {
const value = getRealStyleValue(token);
return parseFloat(value);
};
var normalizeArray = (value) => Array.isArray(value) ? value : [value];
var checkKeyExists = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
var setDefaultValueIfNotAvailable = (target, keyPath, value) => {
const keys = keyPath.split(".");
let currentObj = target;
const finalKey = keys[keys.length - 1];
keys.forEach((key) => {
if (finalKey === key) {
if (!checkKeyExists(currentObj, key)) {
currentObj[key] = value;
}
} else {
if (!checkKeyExists(currentObj, key)) {
currentObj[key] = {};
}
currentObj = currentObj[key];
}
});
};
export {
getRealStyleValue,
getRealValueWithoutUnit,
normalizeArray,
setDefaultValueIfNotAvailable
};
//# sourceMappingURL=chunk.DKVCRWJF.js.map