import { i18next } from '@operato/i18n';
export const SMALLVALUE = 10e-6;
export function formatValueWithPrecision(inputValue, precision = 5) {
    if (typeof inputValue === undefined || inputValue === null) {
        return '-';
    }
    let inputValueNumber = typeof inputValue === 'string' ? parseFloat(inputValue) : inputValue;
    inputValueNumber = isNaN(inputValueNumber) ? 0 : inputValueNumber <= SMALLVALUE ? 0 : inputValueNumber;
    return inputValueNumber.toPrecision(precision);
}
export function changeStreamTypeString(type) {
    switch (type) {
        case 'fluid':
            return i18next.t('label.fluid-type');
        case 'solid':
            return i18next.t('label.solid-type');
        case 'gas':
            return i18next.t('label.gas-type');
        default:
            return i18next.t('label.wrong-type') + `(${type})`;
    }
}
//# sourceMappingURL=utils.js.map