Function
| Static Public Summary | ||
| public |
Format a number using the default options. |
|
| public |
formatFull(val: number, opts: Object): * Format a full-flavor number using the default options. |
|
| public |
formatShort(val: number, opts: Object): * Format a short-flavor number using the default options. |
|
| public |
parse(text: *, config: {}): * |
|
| public |
requireDecimal(config: *): * |
|
Static Public
public format(val: number, opts: Object): * source
import {format} from 'swarm-numberformat/src/format.js'Format a number using the default options.
Return:
| * | string |
Example:
format(1e6)
// => "1.0000 million"
format(1e6, {sigfigs: 1})
// => "1 million"
public formatFull(val: number, opts: Object): * source
import {formatFull} from 'swarm-numberformat/src/format.js'Format a full-flavor number using the default options. Identical to format()
Return:
| * | string |
Example:
format(1e6)
// => "1.0000 million"
public formatShort(val: number, opts: Object): * source
import {formatShort} from 'swarm-numberformat/src/format.js'Format a short-flavor number using the default options.
Return:
| * | string |
Example:
format(1e6)
// => "1.00M"
public parse(text: *, config: {}): * source
import {parse} from 'swarm-numberformat/src/parse.js'Params:
| Name | Type | Attribute | Description |
| text | * | ||
| config | {} |
|
Return:
| * |
public requireDecimal(config: *): * source
import {requireDecimal} from 'swarm-numberformat/src/decimal.js'Params:
| Name | Type | Attribute | Description |
| config | * |
Return:
| * |