Learning from the Mistakes of a v1
summary
Dinero.js v1 is a popular money library (29 releases, 3.6k GitHub stars, peaks of ~6k npm downloads/day) that works but exposes concrete design failures: amounts use integer minor units yet tie to JS Number and max limits; a hardcoded exponent of 2; a built-in REST fetcher for exchange rates; reliance on Intl for formatting; an object‑oriented chainable API that prevents tree-shaking. v2 replaces those with an injectable calculator, explicit currency objects, an optional functional API, accepts promises for rates and lets users provide their own formatting, and moves toward TypeScript.
AI-written summary · about
chapters (42)
- 0:00Introduction
- 2:46Open Source
- 3:11Popular Projects
- 4:58The First Issue
- 5:14Using Numbers
- 5:39FloatingPoint Arithmetic
- 8:43Native Billions
- 9:11Dinero
- 9:43Factory
- 11:18Exponents
- 13:25Decimal Currencies
- 15:20Currency Strings
- 16:16Conversions
- 16:52Too many assumptions
- 17:55API design trends
- 19:37The price to pay
- 20:05User responsibility
- 20:53Native internationalization
- 21:59Readiness API
- 23:16two format
- 23:39high coupling
- 24:04workarounds
- 24:39API implementation
- 26:13Flexible options
- 26:48Internationalization API
- 27:22Manual Internationalization
- 29:00Tree Shake
- 31:04Dynamic API
- 32:09Chainable vs Functional API
- 33:36JavaScript
- 34:38Type Definitions
- 35:48Static Typing
- 37:37What happened
- 37:59My first serious library
- 39:05Building something to fix my problems
- 41:03Assumptions
- 42:37Four Pillars
- 48:50Questions
- 49:21When will v2 be released
- 51:50Functional Programming
- 54:09Benefits of having a popular package
- 56:06Limitations of the current design
related talks
40mPIMP Your JS Library or Desgning Non-Shit APIs with JavaScript
26mSharing is Caring - Patterns for JavaScript Library Design
33mYour code will explode
35mCommon Mistakes in Vue.js and How to Avoid Them
42mYour library sucks, and why you should use it
51mJavaScript Gotchas
23mWhat Can We Learn With JavaScript Fatigue?
34mA year of other’s bugs: the sad state of error handling
