Grouping
Represents the useGrouping option accepted by Intl.NumberFormat.
See Intl.NumberFormat on MDN for full option details.
fromBool
RES
let fromBool: bool => tConstructs a grouping setting from a boolean.
Examples
RESlet formatter =
Intl.NumberFormat.make(
~locales=["en-US"],
~options={useGrouping: Intl.NumberFormat.Grouping.fromBool(false)},
)
formatter->Intl.NumberFormat.format(1234.) == "1234"
fromString
RES
let fromString: [#always | #auto | #min2] => tConstructs a grouping setting from a string literal.
Examples
RESlet formatter =
Intl.NumberFormat.make(
~locales=["en-US"],
~options={useGrouping: Intl.NumberFormat.Grouping.fromString(#always)},
)
formatter->Intl.NumberFormat.format(1234.) == "1,234"
ignore
RES
let ignore: t => unitignore(grouping) ignores the provided grouping and returns unit.
This helper is useful when you want to discard a value (for example, the result of an operation with side effects) without having to store or process it further.
parsed
RES
type parsed = [#always | #auto | #bool(bool) | #min2]parseJsValue
RES
let parseJsValue: 'a => option<[> #always | #auto | #bool(bool) | #min2]>parseJsValue(value) attempts to interpret a JavaScript value as a grouping setting.
Examples
RESIntl.NumberFormat.Grouping.parseJsValue(Js.Json.string("auto")) == Some(#auto)
t
RES
type t