export const cssVar = (name, element = document.documentElement) => {
    const value = window.getComputedStyle(element).getPropertyValue(name);
    const durationRegExp = /(^[\d.]+)(ms|s)$/;
    if (durationRegExp.test(value)) {
        const [, numericValue, unit] = durationRegExp.exec(value);
        return unit === 's' ? numericValue * 1000 : Number(numericValue);
    }
    return value;
};
