{"id":41971,"library":"sl-currency-formatter","title":"SL Currency Formatter","description":"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).","status":"active","version":"1.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/AslamJM/sl-currency-formatter","tags":["javascript","srilankan","rupee","currency-formatter","typescript"],"install":[{"cmd":"npm install sl-currency-formatter","lang":"bash","label":"npm"},{"cmd":"yarn add sl-currency-formatter","lang":"bash","label":"yarn"},{"cmd":"pnpm add sl-currency-formatter","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default import does not exist; must use named import. CJS require is also valid but less common in TypeScript projects.","wrong":"const formatSLR = require('sl-currency-formatter')","symbol":"formatSLR","correct":"import { formatSLR } from 'sl-currency-formatter'"},{"note":"FormatOptions is a TypeScript interface only, export may be type-only. For type-only imports prefer `import type` to avoid runtime errors.","wrong":"import { FormatOptions } from 'sl-currency-formatter'","symbol":"FormatOptions","correct":"import type { FormatOptions } from 'sl-currency-formatter'"},{"note":"No default export; package exports only named `formatSLR`.","wrong":"import formatSLR from 'sl-currency-formatter'","symbol":"default","correct":"import { formatSLR } from 'sl-currency-formatter'"}],"quickstart":{"code":"import { formatSLR } from 'sl-currency-formatter';\n\nconsole.log(formatSLR(123456.78));\n// Output: \"Rs. 1,23,456.78 /=\"\n\nconsole.log(formatSLR('5000', { commas: false, cents: false, prefix: false }));\n// Output: \"5000 /=\"\n\nconsole.log(formatSLR(1000.50, { lang: 'tamil', prefix: false }));\n// Output: \"1,000.50 /=\"","lang":"typescript","description":"Shows basic formatting of a number with default options, stripping commas and cents, and using Tamil language prefix formatting."},"warnings":[{"fix":"Always parse numeric strings to number before passing, or ensure input is a valid numeric string.","message":"Input value may be a string, but non-numeric strings will cause unexpected output.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use only 'english', 'sinhala', or 'tamil' for the `lang` option.","message":"The `lang` option accepts only three values: 'english', 'sinhala', 'tamil'. Using an unsupported string may fallback to default or error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If you need language-specific prefixes, manipulate the prefixCode yourself.","message":"The default `prefixCode` is 'Rs.' and `suffixCode` is ' /='. These are not configurable via language; they stay constant regardless of lang.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.1.2':19 'cent':29 'code':41 'comma':26 'comma-separ':25 'currenc':2,60 'currency-formatt':59 'current':16 'custom':39 'date':23 'depend':45 'display':30 'e.g':54 'english':35 'focus':47 'format':9,50 'formatt':3,53,61 'generic':52 'intl.numberformat':55 'javascript':56 'javascript/typescript':6 'languag':32 'language-prefix':31 'lankan':13 'librari':7 'lkr':15,49 'minim':42 'number':10 'output':28,34 'prefix':33 'prefix/suffix':40 'releas':21 'rupe':14,58 'separ':27 'simpl':5 'singl':20 'sinhala':36 'sl':1 'sri':12 'srilankan':57 'stabl':17 'support':24 'tamil':37 'typescript':62 'unlik':51 'util':46 'version':18 'zero':44 'zero-depend':43","created_at":"2026-06-04T18:54:59.769584+00:00","updated_at":"2026-06-04T18:54:59.769584+00:00","problems":[{"fix":"Use `import { formatSLR } from 'sl-currency-formatter'` instead of `import formatSLR from '...'`.","cause":"Using default import instead of named import.","error":"TypeError: formatSLR is not a function"},{"fix":"Run `npm install sl-currency-formatter` and check package.json.","cause":"Package might not be installed or spelling incorrect.","error":"Cannot find module 'sl-currency-formatter'"},{"fix":"Ensure the value is either a number or a string that can be parsed as a number (e.g., '123').","cause":"Passed a non-numeric value to formatSLR.","error":"Input must be a number or a numeric string"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/AslamJM/sl-currency-formatter#readme","github":"https://github.com/AslamJM/sl-currency-formatter","docs":null,"changelog":null,"pypi":null,"npm":"sl-currency-formatter","openapi_spec":null,"status_page":null,"smithery":null,"categories":["finance"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}