Module

JS.Intl.NumberFormat

Package
purescript-js-intl
Repository
pete-murphy/purescript-js-intl

#NumberFormat Source

data NumberFormat

Language-sensitive number formatting

#NumberFormatOptions Source

type NumberFormatOptions :: Row Typetype NumberFormatOptions = (compactDisplay :: String, currency :: String, currencyDisplay :: String, currencySign :: String, localeMatcher :: String, maximumFractionDigits :: Int, maximumSignificantDigits :: Int, minimumFractionDigits :: Int, minimumIntegerDigits :: Int, minimumSignificantDigits :: Int, notation :: String, numberingSystem :: String, roundingIncrement :: Int, roundingMode :: String, roundingPriority :: String, signDisplay :: String, style :: String, trailingZeroDisplay :: String, unit :: String, unitDisplay :: String, useGrouping :: Foreign)

Options to pass to the NumberFormat constructor (new or new_)

Note: Not all combinations of options are valid. See the specification (https://tc39.es/ecma402/#sec-intl.numberformat) or the MDN reference (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat)

#ToNumberFormatOptions Source

data ToNumberFormatOptions

Instances

#format Source

format :: NumberFormat -> Number -> String

Formats a number according to the locale and formatting options of the NumberFormat

#formatRange Source

formatRange :: NumberFormat -> Number -> Number -> String

Formats a range of numbers according to the locale and formatting options of the NumberFormat

#formatRangeToParts Source

formatRangeToParts :: NumberFormat -> Number -> Number -> Array { type :: String, value :: String }

Returns an array of objects containing the locale-specific tokens from which it is possible to build custom strings while preserving the locale-specific parts

#formatToParts Source

formatToParts :: NumberFormat -> Number -> Array { type :: String, value :: String }

Allows locale-aware formatting of strings produced by the NumberFormat

#convertOptionsWithDefaults Source