Commit c594bbe
committed
Refactor: HF-24 address prep-ultra polish (category, regex hoist, docs)
Address three nits surfaced by the final fresh-eyes review:
- ConfigParams.ts: stringifyCurrency was filed under @category 'Date and
Time' (copied from sibling stringifyDateTime/Duration), placing a
currency-formatting option under the Date and Time TypeDoc nav group.
Move it to @category 'Number' to match where currencySymbol already
lives, so currency-related config clusters together in generated API
docs.
- ConfigParams.ts: expand the stringifyCurrency JSDoc to state plainly
that the formatter calls the callback for every format string that
reaches it, not only currency-shaped ones, and that returning undefined
is the opt-out path for unsupported formats. IDE users reading the
contract no longer have to infer this from the guide.
- format.ts: hoist the LCID-tagged currency-guard regex into a
module-level const (LCID_CURRENCY_TAG) shared by
defaultStringifyDateTime and defaultStringifyDuration. Avoids
re-instantiating the same RegExp on every format() call (TEXT can be
invoked thousands of times per recalc), and documents at the
declaration site why the pattern is intentionally unanchored — Excel
does not mix date/time tokens with currency tags in a single format
string, so a mid-string match cannot misclassify a legitimate
composite.1 parent e0d7af5 commit c594bbe
2 files changed
Lines changed: 22 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
318 | | - | |
319 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
324 | 325 | | |
325 | | - | |
| 326 | + | |
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
13 | 28 | | |
14 | 29 | | |
15 | 30 | | |
| |||
100 | 115 | | |
101 | 116 | | |
102 | 117 | | |
103 | | - | |
| 118 | + | |
104 | 119 | | |
105 | 120 | | |
106 | 121 | | |
| |||
176 | 191 | | |
177 | 192 | | |
178 | 193 | | |
179 | | - | |
| 194 | + | |
180 | 195 | | |
181 | 196 | | |
182 | 197 | | |
| |||
0 commit comments