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

    Interface PercentageFormatSpec

    Locale-aware percentage or other power-of-ten ratio specification.

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

    formatter.format("0.0125", {
    kind: "percentage",
    percentageScale: 10_000,
    percentageSymbol: " bp",
    maximumFractionDigits: 0,
    });
    // "125 bp"
    interface PercentageFormatSpec {
        decimalSeparator?: string;
        groupSeparator?: string;
        infinityDisplay?: string;
        kind: "percentage";
        locale?: string;
        maximumFractionDigits?: number;
        maximumSignificantDigits?: number;
        minimumFractionDigits?: number;
        minimumIntegerDigits?: number;
        minimumSignificantDigits?: number;
        nanDisplay?: string;
        negativeDisplay?: NegativeDisplay;
        numberingSystem?: string;
        percentageScale?: number;
        percentageSymbol?: string;
        roundingIncrement?: number;
        roundingMode?: RoundingMode;
        roundingPriority?: RoundingPriority;
        signDisplay?: SignDisplay;
        trailingZeroDisplay?: "auto" | "stripIfInteger";
        useGrouping?: GroupingDisplay;
        zeroDisplay?: string;
    }

    Hierarchy (View Summary)

    Index
    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: "percentage"

    Selects the built-in percentage 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".

    numberingSystem?: string

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

    percentageScale?: number

    Positive power of ten applied before display and reversed during parsing. Defaults to 100.

    percentageSymbol?: string

    Replaces the locale-derived percent-sign part without changing its placement.

    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.