A simple JavaScript/TypeScript library for formatting numbers as Sri Lankan Rupees (LKR). Current stable version 1.1.2, single release to date. Supports comma-separated output, cents display, language-prefixed output (English, Sinhala, Tamil), and custom prefix/suffix codes. Minimal zero-dependency utility focused on LKR formatting, unlike generic formatters (e.g., Intl.NumberFormat).
npm install sl-currency-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic formatting of a number with default options, stripping commas and cents, and using Tamil language prefix formatting.
Always parse numeric strings to number before passing, or ensure input is a valid numeric string.
Use only 'english', 'sinhala', or 'tamil' for the `lang` option.
If you need language-specific prefixes, manipulate the prefixCode yourself.
Use `import { formatSLR } from 'sl-currency-formatter'` instead of `import formatSLR from '...'`.Run `npm install sl-currency-formatter` and check package.json.
Ensure the value is either a number or a string that can be parsed as a number (e.g., '123').
No dependency data recorded yet.