• Formats a number into a compact string representation.

    This is a lightweight version of the numberFormatter_compact function, which does not use a Decimal instance.

    Parameters

    • number: string | number | bigint | boolean

      The number to format.

    • isMoneyOrCurrecyPrefix: string | boolean

      If true, adds a dollar sign prefix. If a string, uses it as the prefix.

    • compressedDigitsNumDecimalsOptions: NumberFormatterCompactCompressedDigitsNumDecimalsOptions = ...

      Options for decimal places.

    • OptionaldecimalPlaces: number = 0

      The number of decimal places to use when there is no suffix.

    Returns string

    The formatted number.

    numberFormatter_compact_lite(123456789, true); // "$123M"
    numberFormatter_compact_lite(123456789, "€"); // "€123M"
    numberFormatter_compact_lite(12345678); // "12.3M"
    numberFormatter_compact_lite(123456789, false, { 3: 5 }); // "123.45678M"
    numberFormatter_compact_lite(12345678, false, { 3: 5 }); // "12.3M"
    numberFormatter_compact_lite(12345678, false, { 2: 3 }); // "12.345M"