numeric-quantity 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -24
- package/dist/cjs/numeric-quantity.cjs.development.js +21 -24
- package/dist/cjs/numeric-quantity.cjs.development.js.map +1 -1
- package/dist/cjs/numeric-quantity.cjs.production.js +1 -1
- package/dist/cjs/numeric-quantity.cjs.production.js.map +1 -1
- package/dist/numeric-quantity.legacy-esm.js +15 -6
- package/dist/numeric-quantity.legacy-esm.js.map +1 -1
- package/dist/numeric-quantity.mjs +21 -27
- package/dist/numeric-quantity.mjs.map +1 -1
- package/dist/numeric-quantity.production.mjs +1 -1
- package/dist/numeric-quantity.production.mjs.map +1 -1
- package/dist/numeric-quantity.umd.min.js +1 -1
- package/dist/numeric-quantity.umd.min.js.map +1 -1
- package/dist/types/constants.d.ts +78 -0
- package/dist/types/dev.d.ts +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/numericQuantity.d.ts +13 -0
- package/dist/types/parseRomanNumerals.d.ts +8 -0
- package/dist/types/types.d.ts +43 -0
- package/dist/types-esm/constants.d.mts +78 -0
- package/dist/types-esm/dev.d.mts +1 -0
- package/dist/types-esm/index.d.mts +4 -0
- package/dist/types-esm/numericQuantity.d.mts +13 -0
- package/dist/types-esm/parseRomanNumerals.d.mts +8 -0
- package/dist/types-esm/types.d.mts +43 -0
- package/package.json +29 -23
- package/dist/numeric-quantity.d.ts +0 -174
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { NumericQuantityOptions, RomanNumeralAscii, RomanNumeralUnicode, VulgarFraction } from "./types.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Map of Unicode fraction code points to their ASCII equivalents.
|
|
4
|
+
*/
|
|
5
|
+
export declare const vulgarFractionToAsciiMap: Record<VulgarFraction, `${number}/${number | ""}`>;
|
|
6
|
+
/**
|
|
7
|
+
* Captures the individual elements of a numeric string.
|
|
8
|
+
*
|
|
9
|
+
* Capture groups:
|
|
10
|
+
*
|
|
11
|
+
* | # | Description | Example(s) |
|
|
12
|
+
* | --- | ------------------------------------------------ | ------------------------------------------------------------------- |
|
|
13
|
+
* | `0` | entire string | `"2 1/3"` from `"2 1/3"` |
|
|
14
|
+
* | `1` | "negative" dash | `"-"` from `"-2 1/3"` |
|
|
15
|
+
* | `2` | whole number or numerator | `"2"` from `"2 1/3"`; `"1"` from `"1/3"` |
|
|
16
|
+
* | `3` | entire fraction, decimal portion, or denominator | `" 1/3"` from `"2 1/3"`; `".33"` from `"2.33"`; `"/3"` from `"1/3"` |
|
|
17
|
+
*
|
|
18
|
+
* _Capture group 2 may include comma/underscore separators._
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* numericRegex.exec("1") // [ "1", "1", null, null ]
|
|
24
|
+
* numericRegex.exec("1.23") // [ "1.23", "1", ".23", null ]
|
|
25
|
+
* numericRegex.exec("1 2/3") // [ "1 2/3", "1", " 2/3", " 2" ]
|
|
26
|
+
* numericRegex.exec("2/3") // [ "2/3", "2", "/3", null ]
|
|
27
|
+
* numericRegex.exec("2 / 3") // [ "2 / 3", "2", "/ 3", null ]
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const numericRegex: RegExp;
|
|
31
|
+
/**
|
|
32
|
+
* Same as {@link numericRegex}, but allows (and ignores) trailing invalid characters.
|
|
33
|
+
*/
|
|
34
|
+
export declare const numericRegexWithTrailingInvalid: RegExp;
|
|
35
|
+
/**
|
|
36
|
+
* Captures any Unicode vulgar fractions.
|
|
37
|
+
*/
|
|
38
|
+
export declare const vulgarFractionsRegex: RegExp;
|
|
39
|
+
type RomanNumeralSequenceFragment = `${RomanNumeralAscii}` | `${RomanNumeralAscii}${RomanNumeralAscii}` | `${RomanNumeralAscii}${RomanNumeralAscii}${RomanNumeralAscii}` | `${RomanNumeralAscii}${RomanNumeralAscii}${RomanNumeralAscii}${RomanNumeralAscii}`;
|
|
40
|
+
/**
|
|
41
|
+
* Map of Roman numeral sequences to their decimal equivalents.
|
|
42
|
+
*/
|
|
43
|
+
export declare const romanNumeralValues: { [k in RomanNumeralSequenceFragment]? : number };
|
|
44
|
+
/**
|
|
45
|
+
* Map of Unicode Roman numeral code points to their ASCII equivalents.
|
|
46
|
+
*/
|
|
47
|
+
export declare const romanNumeralUnicodeToAsciiMap: Record<RomanNumeralUnicode, keyof typeof romanNumeralValues>;
|
|
48
|
+
/**
|
|
49
|
+
* Captures all Unicode Roman numeral code points.
|
|
50
|
+
*/
|
|
51
|
+
export declare const romanNumeralUnicodeRegex: RegExp;
|
|
52
|
+
/**
|
|
53
|
+
* Captures a valid Roman numeral sequence.
|
|
54
|
+
*
|
|
55
|
+
* Capture groups:
|
|
56
|
+
*
|
|
57
|
+
* | # | Description | Example |
|
|
58
|
+
* | --- | --------------- | ------------------------ |
|
|
59
|
+
* | `0` | Entire string | "MCCXIV" from "MCCXIV" |
|
|
60
|
+
* | `1` | Thousands | "M" from "MCCXIV" |
|
|
61
|
+
* | `2` | Hundreds | "CC" from "MCCXIV" |
|
|
62
|
+
* | `3` | Tens | "X" from "MCCXIV" |
|
|
63
|
+
* | `4` | Ones | "IV" from "MCCXIV" |
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
*
|
|
67
|
+
* ```ts
|
|
68
|
+
* romanNumeralRegex.exec("M") // [ "M", "M", "", "", "" ]
|
|
69
|
+
* romanNumeralRegex.exec("XII") // [ "XII", "", "", "X", "II" ]
|
|
70
|
+
* romanNumeralRegex.exec("MCCXIV") // [ "MCCXIV", "M", "CC", "X", "IV" ]
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare const romanNumeralRegex: RegExp;
|
|
74
|
+
/**
|
|
75
|
+
* Default options for {@link numericQuantity}.
|
|
76
|
+
*/
|
|
77
|
+
export declare const defaultOptions: Required<NumericQuantityOptions>;
|
|
78
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NumericQuantityOptions } from "./types.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a string to a number, like an enhanced version of `parseFloat`.
|
|
4
|
+
*
|
|
5
|
+
* The string can include mixed numbers, vulgar fractions, or Roman numerals.
|
|
6
|
+
*/
|
|
7
|
+
declare function numericQuantity(quantity: string | number): number;
|
|
8
|
+
declare function numericQuantity(quantity: string | number): number;
|
|
9
|
+
declare function numericQuantity(quantity: string | number, options: NumericQuantityOptions & {
|
|
10
|
+
bigIntOnOverflow: true
|
|
11
|
+
}): number | bigint;
|
|
12
|
+
declare function numericQuantity(quantity: string | number, options?: NumericQuantityOptions): number;
|
|
13
|
+
export { numericQuantity };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string of Roman numerals to a number, like `parseInt`
|
|
3
|
+
* for Roman numerals. Uses modern, strict rules (only 1 to 3999).
|
|
4
|
+
*
|
|
5
|
+
* The string can include ASCII representations of Roman numerals
|
|
6
|
+
* or Unicode Roman numeral code points (`U+2160` through `U+217F`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const parseRomanNumerals: (romanNumerals: string) => number;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface NumericQuantityOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Round the result to this many decimal places. Defaults to 3; must
|
|
4
|
+
* be greater than or equal to zero.
|
|
5
|
+
*
|
|
6
|
+
* @default 3
|
|
7
|
+
*/
|
|
8
|
+
round?: number | false;
|
|
9
|
+
/**
|
|
10
|
+
* Allow and ignore trailing invalid characters _à la_ `parseFloat`.
|
|
11
|
+
*
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
allowTrailingInvalid?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Attempt to parse Roman numerals if Arabic numeral parsing fails.
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
romanNumerals?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Generates a `bigint` value if the string represents
|
|
23
|
+
* a valid integer too large for the `number` type.
|
|
24
|
+
*/
|
|
25
|
+
bigIntOnOverflow?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Unicode vulgar fraction code points.
|
|
29
|
+
*/
|
|
30
|
+
export type VulgarFraction = "¼" | "½" | "¾" | "⅐" | "⅑" | "⅒" | "⅓" | "⅔" | "⅕" | "⅖" | "⅗" | "⅘" | "⅙" | "⅚" | "⅛" | "⅜" | "⅝" | "⅞" | "⅟";
|
|
31
|
+
/**
|
|
32
|
+
* Allowable Roman numeral characters (ASCII, uppercase only).
|
|
33
|
+
*/
|
|
34
|
+
export type RomanNumeralAscii = "I" | "V" | "X" | "L" | "C" | "D" | "M";
|
|
35
|
+
/**
|
|
36
|
+
* Unicode Roman numeral code points (uppercase and lowercase,
|
|
37
|
+
* representing 1-12, 50, 100, 500, and 1000).
|
|
38
|
+
*/
|
|
39
|
+
export type RomanNumeralUnicode = "Ⅰ" | "Ⅱ" | "Ⅲ" | "Ⅳ" | "Ⅴ" | "Ⅵ" | "Ⅶ" | "Ⅷ" | "Ⅸ" | "Ⅹ" | "Ⅺ" | "Ⅻ" | "Ⅼ" | "Ⅽ" | "Ⅾ" | "Ⅿ" | "ⅰ" | "ⅱ" | "ⅲ" | "ⅳ" | "ⅴ" | "ⅵ" | "ⅶ" | "ⅷ" | "ⅸ" | "ⅹ" | "ⅺ" | "ⅻ" | "ⅼ" | "ⅽ" | "ⅾ" | "ⅿ";
|
|
40
|
+
/**
|
|
41
|
+
* Union of ASCII and Unicode Roman numeral characters/code points.
|
|
42
|
+
*/
|
|
43
|
+
export type RomanNumeral = RomanNumeralAscii | RomanNumeralUnicode;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.1.0",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "numeric-quantity",
|
|
5
5
|
"author": "Jake Boone <jakeboone02@gmail.com>",
|
|
@@ -12,12 +12,17 @@
|
|
|
12
12
|
"exports": {
|
|
13
13
|
"./package.json": "./package.json",
|
|
14
14
|
".": {
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
"import": {
|
|
16
|
+
"types": "./dist/types-esm/index.d.mts",
|
|
17
|
+
"default": "./dist/numeric-quantity.mjs"
|
|
18
|
+
},
|
|
19
|
+
"require": {
|
|
20
|
+
"types": "./dist/types/index.d.ts",
|
|
21
|
+
"default": "./dist/cjs/index.js"
|
|
22
|
+
}
|
|
18
23
|
}
|
|
19
24
|
},
|
|
20
|
-
"types": "./dist/
|
|
25
|
+
"types": "./dist/types/index.d.ts",
|
|
21
26
|
"unpkg": "./dist/numeric-quantity.umd.min.js",
|
|
22
27
|
"bugs": {
|
|
23
28
|
"url": "https://github.com/jakeboone02/numeric-quantity/issues"
|
|
@@ -37,28 +42,29 @@
|
|
|
37
42
|
"numerals"
|
|
38
43
|
],
|
|
39
44
|
"scripts": {
|
|
40
|
-
"start": "
|
|
41
|
-
"build": "tsup",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
45
|
+
"start": "bun --hot ./main.html",
|
|
46
|
+
"build": "bunx --bun tsup",
|
|
47
|
+
"docs": "typedoc",
|
|
48
|
+
"test": "bun test",
|
|
49
|
+
"watch": "bun test --watch",
|
|
50
|
+
"lint": "bunx oxlint@latest --format=github",
|
|
44
51
|
"publish:npm": "np",
|
|
45
|
-
"
|
|
52
|
+
"codesandbox-ci": "bash .codesandbox/ci.sh",
|
|
53
|
+
"pretty-print": "prettier --write '*.{html,json,ts}' 'src/*.*'"
|
|
46
54
|
},
|
|
47
55
|
"devDependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"@types/
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"np": "^
|
|
53
|
-
"prettier": "
|
|
54
|
-
"prettier-plugin-organize-imports": "
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"typescript": "^5.
|
|
58
|
-
"vite": "^4.3.9"
|
|
56
|
+
"@jakeboone02/generate-dts": "0.1.1",
|
|
57
|
+
"@types/bun": "^1.2.8",
|
|
58
|
+
"@types/node": "^22.13.14",
|
|
59
|
+
"@types/web": "^0.0.214",
|
|
60
|
+
"np": "^10.2.0",
|
|
61
|
+
"prettier": "3.5.3",
|
|
62
|
+
"prettier-plugin-organize-imports": "4.1.0",
|
|
63
|
+
"tsup": "^8.4.0",
|
|
64
|
+
"typedoc": "^0.28.1",
|
|
65
|
+
"typescript": "^5.8.2"
|
|
59
66
|
},
|
|
60
67
|
"engines": {
|
|
61
68
|
"node": ">=16"
|
|
62
|
-
}
|
|
63
|
-
"packageManager": "yarn@3.6.0"
|
|
69
|
+
}
|
|
64
70
|
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
interface NumericQuantityOptions {
|
|
2
|
-
/**
|
|
3
|
-
* Round the result to this many decimal places. Defaults to 3; must
|
|
4
|
-
* be greater than or equal to zero.
|
|
5
|
-
*
|
|
6
|
-
* @default 3
|
|
7
|
-
*/
|
|
8
|
-
round?: number | false;
|
|
9
|
-
/**
|
|
10
|
-
* Allow and ignore trailing invalid characters _à la_ `parseFloat`.
|
|
11
|
-
*
|
|
12
|
-
* @default false
|
|
13
|
-
*/
|
|
14
|
-
allowTrailingInvalid?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Attempt to parse Roman numerals if Arabic numeral parsing fails.
|
|
17
|
-
*
|
|
18
|
-
* @default false
|
|
19
|
-
*/
|
|
20
|
-
romanNumerals?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Unicode vulgar fraction code points
|
|
24
|
-
*/
|
|
25
|
-
type VulgarFraction = '¼' | '½' | '¾' | '⅐' | '⅑' | '⅒' | '⅓' | '⅔' | '⅕' | '⅖' | '⅗' | '⅘' | '⅙' | '⅚' | '⅛' | '⅜' | '⅝' | '⅞' | '⅟';
|
|
26
|
-
/**
|
|
27
|
-
* Allowable Roman numeral characters (ASCII, uppercase only)
|
|
28
|
-
*/
|
|
29
|
-
type RomanNumeralAscii = 'I' | 'V' | 'X' | 'L' | 'C' | 'D' | 'M';
|
|
30
|
-
/**
|
|
31
|
-
* Unicode Roman numeral code points (uppercase and lowercase,
|
|
32
|
-
* representing 1-12, 50, 100, 500, and 1000)
|
|
33
|
-
*/
|
|
34
|
-
type RomanNumeralUnicode = 'Ⅰ' | 'Ⅱ' | 'Ⅲ' | 'Ⅳ' | 'Ⅴ' | 'Ⅵ' | 'Ⅶ' | 'Ⅷ' | 'Ⅸ' | 'Ⅹ' | 'Ⅺ' | 'Ⅻ' | 'Ⅼ' | 'Ⅽ' | 'Ⅾ' | 'Ⅿ' | 'ⅰ' | 'ⅱ' | 'ⅲ' | 'ⅳ' | 'ⅴ' | 'ⅵ' | 'ⅶ' | 'ⅷ' | 'ⅸ' | 'ⅹ' | 'ⅺ' | 'ⅻ' | 'ⅼ' | 'ⅽ' | 'ⅾ' | 'ⅿ';
|
|
35
|
-
/**
|
|
36
|
-
* Union of ASCII and Unicode Roman numeral characters/code points
|
|
37
|
-
*/
|
|
38
|
-
type RomanNumeral = RomanNumeralAscii | RomanNumeralUnicode;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Map of Unicode fraction code points to their ASCII equivalents
|
|
42
|
-
*/
|
|
43
|
-
declare const vulgarFractionToAsciiMap: Record<VulgarFraction, string>;
|
|
44
|
-
/**
|
|
45
|
-
* Captures the individual elements of a numeric string.
|
|
46
|
-
*
|
|
47
|
-
* Capture groups:
|
|
48
|
-
*
|
|
49
|
-
* +=====+====================+========================+
|
|
50
|
-
* | # | Description | Example |
|
|
51
|
-
* +=====+====================+========================+
|
|
52
|
-
* | 0 | entire string | "2 1/3" from "2 1/3" |
|
|
53
|
-
* +-----+--------------------+------------------------+
|
|
54
|
-
* | 1 | "negative" dash | "-" from "-2 1/3" |
|
|
55
|
-
* +-----+--------------------+------------------------+
|
|
56
|
-
* | 2 | the whole number | "2" from "2 1/3" |
|
|
57
|
-
* | | - OR - | |
|
|
58
|
-
* | | the numerator | "1" from "1/3" |
|
|
59
|
-
* | + + |
|
|
60
|
-
* | (This may include comma/underscore separators) |
|
|
61
|
-
* +-----+--------------------+------------------------+
|
|
62
|
-
* | 3 | entire fraction | " 1/3" from "2 1/3" |
|
|
63
|
-
* | | - OR - | |
|
|
64
|
-
* | | decimal portion | ".33" from "2.33" |
|
|
65
|
-
* | | - OR - | |
|
|
66
|
-
* | | denominator | "/3" from "1/3" |
|
|
67
|
-
* +=====+====================+========================+
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* numericRegex.exec("1") // [ "1", "1", null, null ]
|
|
71
|
-
* numericRegex.exec("1.23") // [ "1.23", "1", ".23", null ]
|
|
72
|
-
* numericRegex.exec("1 2/3") // [ "1 2/3", "1", " 2/3", " 2" ]
|
|
73
|
-
* numericRegex.exec("2/3") // [ "2/3", "2", "/3", null ]
|
|
74
|
-
* numericRegex.exec("2 / 3") // [ "2 / 3", "2", "/ 3", null ]
|
|
75
|
-
*/
|
|
76
|
-
declare const numericRegex: RegExp;
|
|
77
|
-
/**
|
|
78
|
-
* Same as `numericRegex`, but allows/ignores trailing invalid characters.
|
|
79
|
-
*/
|
|
80
|
-
declare const numericRegexWithTrailingInvalid: RegExp;
|
|
81
|
-
/**
|
|
82
|
-
* Captures any Unicode vulgar fractions
|
|
83
|
-
*/
|
|
84
|
-
declare const vulgarFractionsRegex: RegExp;
|
|
85
|
-
declare const romanNumeralValues: {
|
|
86
|
-
MMM: number;
|
|
87
|
-
MM: number;
|
|
88
|
-
M: number;
|
|
89
|
-
CM: number;
|
|
90
|
-
DCCC: number;
|
|
91
|
-
DCC: number;
|
|
92
|
-
DC: number;
|
|
93
|
-
D: number;
|
|
94
|
-
CD: number;
|
|
95
|
-
CCC: number;
|
|
96
|
-
CC: number;
|
|
97
|
-
C: number;
|
|
98
|
-
XC: number;
|
|
99
|
-
LXXX: number;
|
|
100
|
-
LXX: number;
|
|
101
|
-
LX: number;
|
|
102
|
-
L: number;
|
|
103
|
-
XL: number;
|
|
104
|
-
XXX: number;
|
|
105
|
-
XX: number;
|
|
106
|
-
XII: number;
|
|
107
|
-
XI: number;
|
|
108
|
-
X: number;
|
|
109
|
-
IX: number;
|
|
110
|
-
VIII: number;
|
|
111
|
-
VII: number;
|
|
112
|
-
VI: number;
|
|
113
|
-
V: number;
|
|
114
|
-
IV: number;
|
|
115
|
-
III: number;
|
|
116
|
-
II: number;
|
|
117
|
-
I: number;
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Map of Unicode Roman numeral code points to their ASCII equivalents
|
|
121
|
-
*/
|
|
122
|
-
declare const romanNumeralUnicodeToAsciiMap: Record<RomanNumeralUnicode, keyof typeof romanNumeralValues>;
|
|
123
|
-
/**
|
|
124
|
-
* Captures all Unicode Roman numeral code points
|
|
125
|
-
*/
|
|
126
|
-
declare const romanNumeralUnicodeRegex: RegExp;
|
|
127
|
-
/**
|
|
128
|
-
* Captures a valid Roman numeral sequence
|
|
129
|
-
*
|
|
130
|
-
* Capture groups:
|
|
131
|
-
*
|
|
132
|
-
* +=====+=================+==========================+
|
|
133
|
-
* | # | Description | Example |
|
|
134
|
-
* +=====+=================+==========================+
|
|
135
|
-
* | 0 | Entire string | "MCCXIV" from "MCCXIV" |
|
|
136
|
-
* +-----+-----------------+--------------------------+
|
|
137
|
-
* | 1 | Thousands | "M" from "MCCXIV" |
|
|
138
|
-
* +-----+-----------------+--------------------------+
|
|
139
|
-
* | 2 | Hundreds | "CC" from "MCCXIV" |
|
|
140
|
-
* +-----+-----------------+--------------------------+
|
|
141
|
-
* | 3 | Tens | "X" from "MCCXIV" |
|
|
142
|
-
* +-----+-----------------+--------------------------+
|
|
143
|
-
* | 4 | Ones | "IV" from "MCCXIV" |
|
|
144
|
-
* +=====+=================+==========================+
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* romanNumeralRegex.exec("M") // [ "M", "M", "", "", "" ]
|
|
148
|
-
* romanNumeralRegex.exec("XII") // [ "XII", "", "", "X", "II" ]
|
|
149
|
-
* romanNumeralRegex.exec("MCCXIV") // [ "MCCXIV", "M", "CC", "X", "IV" ]
|
|
150
|
-
*/
|
|
151
|
-
declare const romanNumeralRegex: RegExp;
|
|
152
|
-
declare const defaultOptions: {
|
|
153
|
-
round: number;
|
|
154
|
-
allowTrailingInvalid: false;
|
|
155
|
-
romanNumerals: false;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Converts a string to a number, like an enhanced version of `parseFloat`.
|
|
160
|
-
*
|
|
161
|
-
* The string can include mixed numbers, vulgar fractions, or Roman numerals.
|
|
162
|
-
*/
|
|
163
|
-
declare const numericQuantity: (quantity: string | number, options?: NumericQuantityOptions) => number;
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Converts a string of Roman numerals to a number, like `parseInt`
|
|
167
|
-
* for Roman numerals. Uses modern, strict rules (only 1 to 3999).
|
|
168
|
-
*
|
|
169
|
-
* The string can include ASCII representations of Roman numerals
|
|
170
|
-
* or Unicode Roman numeral code points (`U+2160` through `U+217F`).
|
|
171
|
-
*/
|
|
172
|
-
declare const parseRomanNumerals: (romanNumerals: string) => number;
|
|
173
|
-
|
|
174
|
-
export { NumericQuantityOptions, RomanNumeral, RomanNumeralAscii, RomanNumeralUnicode, VulgarFraction, defaultOptions, numericQuantity, numericRegex, numericRegexWithTrailingInvalid, parseRomanNumerals, romanNumeralRegex, romanNumeralUnicodeRegex, romanNumeralUnicodeToAsciiMap, romanNumeralValues, vulgarFractionToAsciiMap, vulgarFractionsRegex };
|