nambas
Version:
A simple JS library to format numbers using in-built Intl.NumberFormat
49 lines • 1.89 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EFormatToken = exports.EStyle = exports.ENambaFormat = void 0;
var ENambaFormat;
(function (ENambaFormat) {
/** Thousands format */
ENambaFormat["THOUSANDS"] = "0,0";
/** French percentage format */
ENambaFormat["FRENCH_PERCENTAGE"] = "0,0 %";
/** German percentage format */
ENambaFormat["GERMAN_PERCENTAGE"] = "0 %";
})(ENambaFormat || (exports.ENambaFormat = ENambaFormat = {}));
var EStyle;
(function (EStyle) {
/** (default) for plain number formatting */
EStyle["DECIMAL"] = "decimal";
/** For currency formatting */
EStyle["CURRENCY"] = "currency";
/** For percent formatting */
EStyle["PERCENT"] = "percent";
/** For unit formatting */
EStyle["UNIT"] = "unit";
})(EStyle || (exports.EStyle = EStyle = {}));
var EFormatToken;
(function (EFormatToken) {
/** Basic digit placeholder */
EFormatToken["DIGIT"] = "0";
/** Fixed decimal places, e.g., 0.00 */
EFormatToken["FIXEDDECIMAL"] = "0.00";
/** Thousands separator */
EFormatToken["THOUSANDS"] = "0,0";
/** Abbreviated format (k, M, B, T) */
EFormatToken["ABBREVIATED"] = "0a";
/** Ordinal numbers (1st, 2nd, 3rd) */
EFormatToken["ORDINAL"] = "0o";
/** Percentage (e.g., 50%) */
EFormatToken["PERCENT"] = "0%";
/** Percentage with decimals (e.g., 12.34%) */
EFormatToken["DECIMALPERCENT"] = "0.00%";
/** Currency (symbol will be inserted dynamically) */
EFormatToken["CURRENCY"] = "@";
/** Scientific notation (e.g., 1.23e+4) */
EFormatToken["SCIENTIFIC"] = "0e+0";
/** Human-readable duration (e.g., 1h 20m) */
EFormatToken["DURATION"] = "0d";
/** Byte size (e.g., 1.5MB) */
EFormatToken["DATASIZE"] = "0b";
})(EFormatToken || (exports.EFormatToken = EFormatToken = {}));
//# sourceMappingURL=types.js.map