new Numbr(value, langopt)
A wrapper for numeral-like formatting
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
value |
number | ||
lang |
string |
<optional> |
Methods
-
clone() → {Numbr}
-
Returns a new Numbr object with the same value and language as this Numbr.
Returns:
- Type
- Numbr
-
format(fmtopt, roundFnopt) → {string}
-
Formats the wrapped value according to fmt. By default, the format is compiled into a series of transformations and then cached globally, if you'd like to disable the caching feature, use numbr.cacheEnabled.
Parameters:
Name Type Attributes Default Description fmtstring <optional>
roundFnfunction <optional>
Math.round Returns:
The formatted number- Type
- string
-
set(num)
-
Sets the wrapped value
Parameters:
Name Type Description numnumber -
setLang(lang)
-
Sets the language for this Numbr. The provided language must be already loaded via numbr.loadLang.
Parameters:
Name Type Description langThe language code -
value() → {number}
-
Access to the wrapped value
Returns:
- Type
- number
-
valueOf() → {number}
-
Returns:
- Type
- number