• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

forzagreen / n2words / 33686344405
99%

Build:
DEFAULT BRANCH: main
Ran 02 Sep 2026 09:40PM UTC
Jobs 1
Files 127
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 Sep 2026 09:39PM UTC coverage: 98.831% (+0.1%) from 98.73%
33686344405

push

github

web-flow
feat(core)!: stop bare tags from inheriting a country's default currency (#436)

A bare tag names a language; a default currency belongs to a country. `en-US`
defaults to USD because a locale has a country and a country has a currency.
`en` has no country — so inheriting en-US's default meant `n2words/en`'s
toCurrency(42.50) quietly returned dollars to a caller who asked only for
English, across sixteen variants spanning USD, GBP, INR, KES, NGN and ZAR.
Same shape for es -> EUR (against es-MX/MXN and es-US/USD) and fr -> EUR.

Each of the 46 alias files now shadows `toCurrency` and `currencyDefaults`,
using the same mechanism a locale profile uses to override a default:

  toCurrency(42.50)                      // TypeError
  toCurrency(42.50, { currency: 'GBP' }) // 'forty-two pounds and fifty pence'

Region-qualified entry points are untouched — `n2words/en-US` still defaults
to USD, which is the whole point of the distinction. `toCardinal`, `toOrdinal`,
`currencyValues` and `currencyMax` stay reference-identical to the target's.

Three details:

- `currencyDefaults` is derived from the target's rather than hand-listed, so
  an option added to the target later can't silently go missing here.
- The target's own options contract runs first, so a typo'd key reports itself
  (`Unknown option "currencey"`) instead of being masked by the missing-currency
  error. TypeError is right for both — resolve-options.js reserves TypeError for
  shape errors and RangeError for values outside a declared set, and an absent
  required option is a shape error.
- A language that hardcodes one currency has no `currency` option and so
  nothing to strip; its alias stays a plain `export *`. The gate keys off
  exactly that, making the wrapper mandatory the moment such a language gains
  the option.

test/bare-tag-contract.test.js drops toCurrency/currencyDefaults from the
blanket identity list and asserts the new contract instead: the wrapper is a
distinct function, no `cu... (continued)

5414 of 5649 branches covered (95.84%)

Branch coverage included in aggregate %.

2714 of 2714 new or added lines in 46 files covered. (100.0%)

30933 of 31128 relevant lines covered (99.37%)

1297.92 hits per line

Jobs
ID Job ID Ran Files Coverage
1 33686344405.1 02 Sep 2026 09:40PM UTC 127
98.83
GitHub Action Run
Source Files on build 33686344405
  • Tree
  • List 127
  • Changed 68
  • Source Changed 46
  • Coverage Changed 68
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #33686344405
  • 0788681a on github
  • Prev Build on main (#33686124458)
  • Next Build on main (#33686688348)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc