numeric-quantity
Advanced tools
Changelog
[v2.0.1] - 2024-01-15
package.json
to distributed type definition files.Changelog
[v2.0.0] - 2023-06-16
numericQuantity
is now a named export; there is no default export.numericQuantity
, to the global object NumericQuantity
. Previously, it assigned the main function to the global namespace as numericQuantity
.','
) and underscore ('_'
) separators within Arabic numeral sequences. If a numeric sequence has a leading or trailing separator, that sequence will be considered invalid. This will cause numericQuantity
to return NaN
unless allowTrailingInvalid
is true
(see next item), in which case the sequence in question and everything after it will be ignored.allowTrailingInvalid
(boolean
, default false
): Allows numericQuantity
to more closely resemble the behavior of parseFloat
by accepting and ignoring everything from the first invalid character to the end of the string.romanNumerals
(boolean
, default false
): Enables support for Roman numerals with modern, strict rules, including the Unicode code points U+2160
through U+217F
. Roman numerals will only be parsed if an attempt to parse the string based on Arabic numerals fails. To parse Roman numerals unconditionally, call parseRomanNumerals
directly.round
(number | false
, default 3
): Rounds the result to the specified number of decimal places. Use round: false
to avoid rounding.'⅟'
, U+215F
), which must be followed by a numeric sequence (the denominator) to be considered part of a valid fraction representation.Changelog
[v1.0.2] - 2021-08-23
⁄
, U+2044
).