NumberFormat
t
RESCRIPT
type tcurrency
RESCRIPT
type currency = stringAn 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 = stringDefined 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: (~locales: array<string>=?, ~options: options=?) => tsupportedLocalesOf
RESCRIPT
let supportedLocalesOf: (array<string>, ~options: supportedLocalesOptions=?) => tresolvedOptions
RESCRIPT
let resolvedOptions: t => resolvedOptionsformat
RESCRIPT
let format: (t, float) => stringformatRange
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) => stringformatIntRange
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, bigint) => stringformatBigIntRange
RESCRIPT
let formatBigIntRange: (t, ~start: bigint, ~end: bigint) => array<string>formatBigIntToParts
RESCRIPT
let formatBigIntToParts: (t, bigint) => array<numberFormatPart>formatBigIntRangeToParts
RESCRIPT
let formatBigIntRangeToParts: (t, ~start: bigint, ~end: bigint) => array<numberFormatPart>formatString
RESCRIPT
let formatString: (t, string) => stringformatStringToParts
RESCRIPT
let formatStringToParts: (t, string) => array<numberFormatRangePart>