UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

22 lines (21 loc) 881 B
"use client"; const require_get_digit_parts = require("./get-digit-parts.cjs"); //#region packages/@mantine/core/src/components/RollingNumber/build-value.ts function buildValue({ value, prefix, suffix, decimalSeparator = ".", thousandSeparator, decimalScale, fixedDecimalScale }) { const parts = require_get_digit_parts.getDigitParts({ value, decimalScale, fixedDecimalScale }); let intStr = parts.intDigits.join(""); if (thousandSeparator) { const sep = typeof thousandSeparator === "string" ? thousandSeparator : ","; intStr = intStr.replace(/\B(?=(\d{3})+(?!\d))/g, sep); } let result = parts.negative ? `-${intStr}` : intStr; if (parts.fracDigits.length > 0) result += `${decimalSeparator}${parts.fracDigits.join("")}`; return `${prefix || ""}${result}${suffix || ""}`; } //#endregion exports.buildValue = buildValue; //# sourceMappingURL=build-value.cjs.map