Rewritten
### `formatCurrency(amount, currency?)`
Format a number as a currency string.
```js
formatCurrency(1999.5); // "$1,999.50"
formatCurrency(1999.5, 'EUR'); // "€1,999.50"
```
Pass an ISO currency code as the second argument to override the default (`USD`).
About this tool
The usage section is the part of a README people actually read — a quick description plus an example showing how to call the thing. Writing it is tedious after you've already built the feature. This tool takes a function or module and drafts a markdown usage section: a one-line summary and a minimal example with a short explanation. It's aimed at open-source maintainers and anyone documenting an internal library who wants a solid first draft of the docs instead of a blank code fence.
Frequently asked questions
Does it output markdown?+
Yes — it's formatted as a markdown section with a heading and a fenced code example, ready to paste into a README.
Will the usage example actually run?+
It writes a plausible example from the code's signature. Verify it against your real implementation, especially if behavior depends on details not visible in the snippet.
Can I use this for a whole library at once?+
It works best on one function or module at a time. Run each piece separately for a clean, focused section.