This is the latest docs version
Quick Links
  • -Overview
  • -Language Features
  • -JS Interop
  • -Build System
Documentation
Language Manual
Reference for all language features
ReScript & React
First class bindings for ReactJS
GenType
Seamless TypeScript integration
Reanalyze
Dead Code & Termination analysis
Exploration
Packages
Explore third party libraries and bindings
Syntax Lookup
Discover all syntax constructs
APIPlaygroundBlogCommunity
  • Playground
  • Blog
  • Twitter
  • GitHub
  • Forum
Core Module
Overview
Core
submodules
  • Array
  • ArrayBuffer
  • AsyncIterator
  • BigInt
  • BigInt64Array
    • Constants
    BigUint64Array
    • Constants
  • Console
  • DataView
  • Date
    • UTC
  • Dict
  • Error
    • URIError
    • TypeError
    • SyntaxError
    • ReferenceError
    • RangeError
    • EvalError
  • Exn
  • Float
    • Constants
    Float32Array
    • Constants
    Float64Array
    • Constants
    Int
    • Constants
    Int16Array
    • Constants
    Int32Array
    • Constants
    Int8Array
    • Constants
  • Internal
  • Intl
    • Segments
    • Segmenter
    • RelativeTimeFormat
    • PluralRules
    • NumberFormat
      • t
        t
      • t
        currency
      • t
        currencyDisplay
      • t
        currencySign
      • t
        notation
      • t
        compactDisplay
      • t
        signDisplay
      • t
        style
      • t
        unitSystem
      • t
        unitDisplay
      • t
        rounding
      • t
        roundingPriority
      • t
        roundingIncrement
      • t
        trailingZeroDisplay
      • t
        options
      • t
        resolvedOptions
      • t
        supportedLocalesOptions
      • t
        numberFormatPartType
      • t
        numberFormatPart
      • t
        rangeSource
      • t
        numberFormatRangePart
      • v
        make
      • v
        supportedLocalesOf
      • v
        resolvedOptions
      • v
        format
      • v
        formatRange
      • v
        formatToParts
      • v
        formatRangeToParts
      • v
        formatInt
      • v
        formatIntRange
      • v
        formatIntToParts
      • v
        formatIntRangeToParts
      • v
        formatBigInt
      • v
        formatBigIntRange
      • v
        formatBigIntToParts
      • v
        formatBigIntRangeToParts
      • v
        formatString
      • v
        formatStringToParts
      • Grouping
    • Locale
    • ListFormat
    • DateTimeFormat
    • Collator
    • Common
  • Iterator
  • JSON
    • Decode
    • Encode
    • Classify
  • List
  • Map
  • MapperRt
  • Math
    • Int
    • Constants
  • Null
  • Nullable
  • Object
  • Option
  • Ordering
  • Promise
  • Re
    • Result
    RegExp
    • Result
  • Result
  • Set
  • String
  • Symbol
  • Type
    • Classify
  • TypedArray
  • Uint16Array
    • Constants
    Uint32Array
    • Constants
    Uint8Array
    • Constants
    Uint8ClampedArray
    • Constants
  • WeakMap
  • WeakSet
  • API / Core / Intl / Numberformat

    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: (~locales: array<string>=?, ~options: options=?) => t

    supportedLocalesOf

    RESCRIPT
    let supportedLocalesOf: (array<string>, ~options: 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, bigint) => string

    formatBigIntRange

    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) => string

    formatStringToParts

    RESCRIPT
    let formatStringToParts: (t, string) => array<numberFormatRangePart>
    Types and values
    • t
      t
    • t
      currency
    • t
      currencyDisplay
    • t
      currencySign
    • t
      notation
    • t
      compactDisplay
    • t
      signDisplay
    • t
      style
    • t
      unitSystem
    • t
      unitDisplay
    • t
      rounding
    • t
      roundingPriority
    • t
      roundingIncrement
    • t
      trailingZeroDisplay
    • t
      options
    • t
      resolvedOptions
    • t
      supportedLocalesOptions
    • t
      numberFormatPartType
    • t
      numberFormatPart
    • t
      rangeSource
    • t
      numberFormatRangePart
    • v
      make
    • v
      supportedLocalesOf
    • v
      resolvedOptions
    • v
      format
    • v
      formatRange
    • v
      formatToParts
    • v
      formatRangeToParts
    • v
      formatInt
    • v
      formatIntRange
    • v
      formatIntToParts
    • v
      formatIntRangeToParts
    • v
      formatBigInt
    • v
      formatBigIntRange
    • v
      formatBigIntToParts
    • v
      formatBigIntRangeToParts
    • v
      formatString
    • v
      formatStringToParts

    © 2024 The ReScript Project

    Software and assets distribution powered by KeyCDN.

    About
    • Community
    • ReScript Association
    Find us on