QuantityFormatter

Methods
4
Fields
None

Methods

MethodReturnsDescription
quantityToStackSize(number)stringA short K/M/B stack size of at most six characters, e.g. 9,450, 2.14B, 100K.
quantityToRSDecimalStack(number)string(number) -> string: The stack size as the game prints it, truncated to one decimal.
quantityToRSDecimalStack(number, boolean)string
parseQuantity(string)number"1.5m" as 1500000; an error for text that is not a quantity.
formatNumber(number)stringComma-grouped, with at most three decimals rounded half-even, e.g. 10,123,351, 5.612.

Method details

quantityToStackSize

quantityToStackSize: (number) -> string

A short K/M/B stack size of at most six characters, e.g. 9,450, 2.14B, 100K.

quantityToRSDecimalStack

quantityToRSDecimalStack: ((number) -> string) & ((number, boolean) -> string)

(number) -> string: The stack size as the game prints it, truncated to one decimal.

(number, boolean) -> string: As the one-argument form, with three decimals for millions and up when precise.

parseQuantity

parseQuantity: (string) -> number

"1.5m" as 1500000; an error for text that is not a quantity.

formatNumber

formatNumber: (number) -> string

Comma-grouped, with at most three decimals rounded half-even, e.g. 10,123,351, 5.612.