Skip to content

Commit

Permalink
Upgrade dependencies; misc tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeboone02 committed Nov 30, 2023
1 parent 0069d57 commit e35b491
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
Binary file modified bun.lockb
Binary file not shown.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@
"pretty-print": "bunx prettier --write *.{mjs,ts,json} src/*.*"
},
"devDependencies": {
"@types/node": "^20.6.1",
"@types/web": "^0.0.114",
"bun-types": "^1.0.1",
"np": "^8.0.4",
"@types/node": "^20.10.1",
"@types/web": "^0.0.123",
"bun-types": "^1.0.14",
"np": "^9.0.0",
"open": "^9.1.0",
"prettier": "^3.0.3",
"prettier-plugin-organize-imports": "^3.2.3",
"tsup": "^7.2.0",
"typedoc": "^0.25.1",
"typescript": "^5.2.2"
"prettier": "^3.1.0",
"prettier-plugin-organize-imports": "^3.2.4",
"tsup": "^8.0.1",
"typedoc": "^0.25.4",
"typescript": "^5.3.2"
},
"engines": {
"node": ">=16"
Expand Down
19 changes: 12 additions & 7 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ export const vulgarFractionToAsciiMap: Record<VulgarFraction, string> = {
export const numericRegex =
/^(?=-?\s*\.\d|-?\s*\d)(-)?\s*((?:\d(?:[\d,_]*\d)?)*)(([eE][+-]?\d(?:[\d,_]*\d)?)?|\.\d(?:[\d,_]*\d)?([eE][+-]?\d(?:[\d,_]*\d)?)?|(\s+\d(?:[\d,_]*\d)?\s*)?\s*\/\s*\d(?:[\d,_]*\d)?)?$/;
/**
* Same as {@link numericRegex}, but allows/ignores trailing invalid characters.
* Same as {@link numericRegex}, but allows (and ignores) trailing invalid characters.
*/
export const numericRegexWithTrailingInvalid =
/^(?=-?\s*\.\d|-?\s*\d)(-)?\s*((?:\d(?:[\d,_]*\d)?)*)(([eE][+-]?\d(?:[\d,_]*\d)?)?|\.\d(?:[\d,_]*\d)?([eE][+-]?\d(?:[\d,_]*\d)?)?|(\s+\d(?:[\d,_]*\d)?\s*)?\s*\/\s*\d(?:[\d,_]*\d)?)?(?:\s*[^\.\d\/].*)?/;
export const numericRegexWithTrailingInvalid = new RegExp(
numericRegex.source.replace(/\$$/, '(?:\\s*[^\\.\\d\\/].*)?')
);

/**
* Captures any Unicode vulgar fractions.
Expand All @@ -86,6 +87,9 @@ type RomanNumeralSequenceFragment =
| `${RomanNumeralAscii}${RomanNumeralAscii}${RomanNumeralAscii}`
| `${RomanNumeralAscii}${RomanNumeralAscii}${RomanNumeralAscii}${RomanNumeralAscii}`;

/**
* Map of Roman numeral sequences to their decimal equivalents.
*/
export const romanNumeralValues = {
MMM: 3000,
MM: 2000,
Expand All @@ -107,10 +111,8 @@ export const romanNumeralValues = {
XL: 40,
XXX: 30,
XX: 20,
// Twelve is only here for tests; not used in practice
XII: 12,
// Eleven is only here for tests; not used in practice
XI: 11,
XII: 12, // only here for tests; not used in practice
XI: 11, // only here for tests; not used in practice
X: 10,
IX: 9,
VIII: 8,
Expand Down Expand Up @@ -232,6 +234,9 @@ export const romanNumeralRegex =
/^(?=[MDCLXVI])(M{0,3})(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$/i;
// #endregion

/**
* Default options for {@link numericQuantity}.
*/
export const defaultOptions = {
round: 3,
allowTrailingInvalid: false,
Expand Down

0 comments on commit e35b491

Please sign in to comment.