@neutrium/formatter - v1.0.1
    Preparing search index...

    Interface NumberFormatSpec

    Locale-aware decimal number specification.

    import { formatter } from "@neutrium/formatter";

    formatter.format("9007199254740993.25", {
    kind: "number",
    maximumFractionDigits: 2,
    });
    // "9,007,199,254,740,993.25"
    interface NumberFormatSpec {
        compactDisplay?: "long" | "short";
        compactExponent?: number;
        decimalSeparator?: string;
        groupSeparator?: string;
        infinityDisplay?: string;
        kind: "number";
        locale?: string;
        maximumFractionDigits?: number;
        maximumSignificantDigits?: number;
        minimumFractionDigits?: number;
        minimumIntegerDigits?: number;
        minimumSignificantDigits?: number;
        nanDisplay?: string;
        negativeDisplay?: NegativeDisplay;
        notation?: NumberNotation;
        numberingSystem?: string;
        roundingIncrement?: number;
        roundingMode?: RoundingMode;
        roundingPriority?: RoundingPriority;
        signDisplay?: SignDisplay;
        trailingZeroDisplay?: "auto" | "stripIfInteger";
        useGrouping?: GroupingDisplay;
        zeroDisplay?: string;
    }

    Hierarchy (View Summary)

    Index
    compactDisplay?: "long" | "short"

    Short or long affixes for compact notation. Defaults to short.

    compactExponent?: number

    Fixes a power-of-ten scale while retaining the locale's compact affix. The exponent must start a compact magnitude in the selected locale.

    decimalSeparator?: string

    Replace the locale-derived decimal part after Intl formatting.

    groupSeparator?: string

    Replace the locale-derived grouping part after Intl formatting.

    infinityDisplay?: string

    Replacement for the localized infinity magnitude.

    kind: "number"

    Selects the built-in number codec.

    locale?: string

    BCP 47 locale overriding the formatter default for this operation.

    maximumFractionDigits?: number

    Maximum fraction digits, rounding excess digits. Does not require that many digits to be shown.

    maximumSignificantDigits?: number

    Maximum number of significant digits.

    minimumFractionDigits?: number

    Minimum fraction digits, padding with zeros as needed. Set both fraction limits for fixed precision.

    minimumIntegerDigits?: number

    Minimum number of integer digits.

    minimumSignificantDigits?: number

    Minimum number of significant digits.

    nanDisplay?: string

    Replacement for the localized NaN magnitude.

    negativeDisplay?: NegativeDisplay

    Render displayed negative signs as parentheses. Defaults to "sign".

    notation?: NumberNotation

    Decimal notation style. Defaults to standard.

    numberingSystem?: string

    Unicode numbering-system identifier, such as latn or arab.

    roundingIncrement?: number

    Increment at the configured fraction precision. For example, 5 with both fraction limits set to 2 rounds to multiples of 0.05. Intl requires equal fraction limits and rejects incompatible significant-digit options.

    roundingMode?: RoundingMode

    Rounding direction used when precision reduces the value. Defaults to halfExpand.

    roundingPriority?: RoundingPriority

    Chooses the winning precision rule when fraction and significant digits are both configured.

    signDisplay?: SignDisplay

    Controls when a positive or negative sign is displayed.

    trailingZeroDisplay?: "auto" | "stripIfInteger"

    Whether insignificant trailing zeroes are retained.

    useGrouping?: GroupingDisplay

    Localized digit-grouping behavior.

    zeroDisplay?: string

    Whole-output replacement for displayed zero, including rounded and negative zero. Omits signs and affixes. Parsing recognizes it as "0" before ordinary numeric syntax, so choose text that does not collide with a nonzero presentation.