function FN(value: NumberType): FNType

Fluent API for performing multiple formatting operations in a readable chain.

Params

  • value (NumberType): The initial value to format. Can be a number, string, or bigint.

Methods

  • .round(options): Sets rounding strategy and precision.
  • .compact(): Formats the number into a short, human-readable string (K, M, B).
  • .prefix(symbol): Prepends a string (e.g., "$").
  • .suffix(symbol): Appends a string (e.g., " units").
  • .toNumber(): Returns the final formatted string.

Returns

(FNType): A chainable object for further formatting.

Example

value
rounding
precision
isCompact
prefix
suffix
FN('1234.567').round({ precision: 2 }).prefix('$').toNumber();

Result: $1234.57

COPYRIGHT © 2026