NumberFormat
t
RESCRIPT
type t
currency
RESCRIPT
type currency = string
An ISO 4217 currency code. e.g. USD, EUR, CNY
currencyDisplay
RESCRIPT
type currencyDisplay = [
| #code
| #name
| #narrowSymbol
| #symbol
]
currencySign
RESCRIPT
type currencySign = [#accounting | #standard]
notation
RESCRIPT
type notation = [
| #compact
| #engineering
| #scientific
| #standard
]
compactDisplay
RESCRIPT
type compactDisplay = [#long | #short]
Used only when notation is #compact
signDisplay
RESCRIPT
type signDisplay = [
| #always
| #auto
| #exceptZero
| #negative
| #never
]
style
RESCRIPT
type style = [#currency | #decimal | #percent | #unit]
unitSystem
RESCRIPT
type unitSystem = string
Defined in https://tc39.es/proposal-unified-intl-numberformat/section6/locales-currencies-tz_proposed_out.html#sec-issanctionedsimpleunitidentifier Only used when style is #unit
unitDisplay
RESCRIPT
type unitDisplay = [#long | #narrow | #short]
Only used when style is #unit
rounding
RESCRIPT
type rounding = [
| #ceil
| #expand
| #floor
| #halfCeil
| #halfEven
| #halfExpand
| #halfFloor
| #halfTrunc
| #trunc
]
roundingPriority
RESCRIPT
type roundingPriority = [
| #auto
| #lessPrecision
| #morePrecision
]
roundingIncrement
RESCRIPT
type roundingIncrement = [
| #1
| #10
| #100
| #1000
| #2
| #20
| #200
| #2000
| #25
| #250
| #2500
| #5
| #50
| #500
| #5000
]
trailingZeroDisplay
RESCRIPT
type trailingZeroDisplay = [
| #auto
| #lessPrecision
| #stripIfInteger
]
options
RESCRIPT
type options = {
compactDisplay?: compactDisplay,
numberingSystem?: Core__Intl__Common.numberingSystem,
currency?: currency,
currencyDisplay?: currencyDisplay,
currencySign?: currencySign,
localeMatcher?: Core__Intl__Common.localeMatcher,
notation?: notation,
signDisplay?: signDisplay,
style?: style,
unit?: unitSystem,
unitDisplay?: unitDisplay,
useGrouping?: Grouping.t,
roundingMode?: rounding,
roundingPriority?: roundingPriority,
roundingIncrement?: roundingIncrement,
trailingZeroDisplay?: trailingZeroDisplay,
minimumIntegerDigits?: Core__Intl__Common.oneTo21,
minimumFractionDigits?: Core__Intl__Common.zeroTo20,
maximumFractionDigits?: Core__Intl__Common.zeroTo20,
minimumSignificantDigits?: Core__Intl__Common.oneTo21,
maximumSignificantDigits?: Core__Intl__Common.oneTo21,
}
resolvedOptions
RESCRIPT
type resolvedOptions = {
currency?: currency,
currencyDisplay?: currencyDisplay,
currencySign?: currencySign,
compactDisplay?: compactDisplay,
unit: unitSystem,
unitDisplay: unitDisplay,
roundingMode?: rounding,
roundingPriority?: roundingPriority,
roundingIncrement?: roundingIncrement,
minimumIntegerDigits?: Core__Intl__Common.oneTo21,
minimumFractionDigits?: Core__Intl__Common.zeroTo20,
maximumFractionDigits?: Core__Intl__Common.zeroTo20,
minimumSignificantDigits?: Core__Intl__Common.oneTo21,
maximumSignificantDigits?: Core__Intl__Common.oneTo21,
locale: string,
notation: notation,
numberingSystem: Core__Intl__Common.numberingSystem,
signDisplay: signDisplay,
style: style,
useGrouping: Grouping.t,
}
supportedLocalesOptions
RESCRIPT
type supportedLocalesOptions = {
localeMatcher: Core__Intl__Common.localeMatcher,
}
numberFormatPartType
RESCRIPT
type numberFormatPartType = [
| #compact
| #currency
| #decimal
| #exponentInteger
| #exponentMinusSign
| #exponentSeparator
| #fraction
| #group
| #infinity
| #integer
| #literal
| #minusSign
| #nan
| #percentSign
| #plusSign
| #unit
| #unknown
]
numberFormatPart
RESCRIPT
type numberFormatPart = {
\"type": numberFormatPartType,
value: string,
}
rangeSource
RESCRIPT
type rangeSource = [#endRange | #shared | #startRange]
numberFormatRangePart
RESCRIPT
type numberFormatRangePart = {
\"type": numberFormatPartType,
value: string,
source: rangeSource,
}
make
RESCRIPT
let make: unit => t
makeWithLocale
RESCRIPT
let makeWithLocale: string => t
makeWithLocales
RESCRIPT
let makeWithLocales: array<string> => t
makeWithLocaleAndOptions
RESCRIPT
let makeWithLocaleAndOptions: (string, options) => t
makeWithLocalesAndOptions
RESCRIPT
let makeWithLocalesAndOptions: (array<string>, options) => t
makeWithOptions
RESCRIPT
let makeWithOptions: options => t
supportedLocalesOf
RESCRIPT
let supportedLocalesOf: array<string> => t
supportedLocalesOfWithOptions
RESCRIPT
let supportedLocalesOfWithOptions: (array<string>, supportedLocalesOptions) => t
resolvedOptions
RESCRIPT
let resolvedOptions: t => resolvedOptions
format
RESCRIPT
let format: (t, float) => string
formatRange
RESCRIPT
let formatRange: (t, ~start: float, ~end: float) => array<string>
formatToParts
RESCRIPT
let formatToParts: (t, float) => array<numberFormatPart>
formatRangeToParts
RESCRIPT
let formatRangeToParts: (
t,
~start: float,
~end: float,
) => array<numberFormatRangePart>
formatInt
RESCRIPT
let formatInt: (t, int) => string
formatIntRange
RESCRIPT
let formatIntRange: (t, ~start: int, ~end: int) => array<string>
formatIntToParts
RESCRIPT
let formatIntToParts: (t, int) => array<numberFormatPart>
formatIntRangeToParts
RESCRIPT
let formatIntRangeToParts: (t, ~start: int, ~end: int) => array<numberFormatRangePart>
formatBigInt
RESCRIPT
let formatBigInt: (t, Core__BigInt.t) => string
formatBigIntRange
RESCRIPT
let formatBigIntRange: (
t,
~start: Core__BigInt.t,
~end: Core__BigInt.t,
) => array<string>
formatBigIntToParts
RESCRIPT
let formatBigIntToParts: (t, Core__BigInt.t) => array<numberFormatPart>
formatBigIntRangeToParts
RESCRIPT
let formatBigIntRangeToParts: (
t,
~start: Core__BigInt.t,
~end: Core__BigInt.t,
) => array<numberFormatPart>
formatString
RESCRIPT
let formatString: (t, string) => string
formatStringToParts
RESCRIPT
let formatStringToParts: (t, string) => array<numberFormatRangePart>