@rtorcato/js-common 1.4.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +5 -5
- package/dist/currency/currencies.js +1 -1
- package/dist/currency/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-7MXMG6WN.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.5.0](https://github.com/rtorcato/js-common/compare/v1.4.2...v1.5.0) (2026-01-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **currency:** add lazy loading and new features ([e9369a8](https://github.com/rtorcato/js-common/commit/e9369a8af5355cea9d348c94776037158680f30d))
|
|
7
|
+
|
|
1
8
|
## [1.4.2](https://github.com/rtorcato/js-common/compare/v1.4.1...v1.4.2) (2026-01-16)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -33,13 +33,13 @@ This package includes a command-line interface for many utilities:
|
|
|
33
33
|
npm install -g @rtorcato/js-common
|
|
34
34
|
|
|
35
35
|
# Or use with npx
|
|
36
|
-
npx @rtorcato/js-common --help
|
|
36
|
+
npx @rtorcato/js-common@latest --help
|
|
37
37
|
|
|
38
38
|
# Examples
|
|
39
|
-
npx @rtorcato/js-common date today
|
|
40
|
-
npx @rtorcato/js-common math sum 1 2 3 4 5
|
|
41
|
-
npx @rtorcato/js-common text capitalize "hello world"
|
|
42
|
-
npx @rtorcato/js-common
|
|
39
|
+
npx @rtorcato/js-common@latest date today
|
|
40
|
+
npx @rtorcato/js-common@latest math sum 1 2 3 4 5
|
|
41
|
+
npx @rtorcato/js-common@latest text capitalize "hello world"
|
|
42
|
+
npx @rtorcato/js-common@latest system node-version
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
See [CLI.md](./CLI.md) for complete CLI documentation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";var R=["CAD","USD","AUD","EUR","GBP","JPY","CHF","CNY","NZD","SGD","SEK","NOK","DKK","MXN","HKD","KRW","TRY","RUB","INR","BRL","ZAR","ILS","MYR","PHP","PLN","THB","TWD","CZK","HUF","IDR","BGN","RON","HRK","COP","CRC","XCD","XDR","XAG","XAU","XPT","XPD","XTS","XXX"],D=R;export{R as currencies,D as default};
|
package/dist/currency/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";var o=null;async function a(){if(o)return o;let{default:r}=await import("./currencies.js");return o=r,r}var l=r=>{try{let n=new Intl.NumberFormat("en",{currency:r,style:"currency"}).formatToParts(0).find(e=>e.type==="currency");return n?.value==="\xA4"?void 0:n?.value}catch{return}};function m(r,n="en"){try{return new Intl.DisplayNames([n],{type:"currency"}).of(r.toUpperCase())}catch{return}}function i(r){return{USD:"en-US",EUR:"de-DE",GBP:"en-GB",JPY:"ja-JP",CNY:"zh-CN",CAD:"en-CA",AUD:"en-AU",CHF:"de-CH",NZD:"en-NZ",SGD:"en-SG",HKD:"zh-HK",KRW:"ko-KR",INR:"en-IN",BRL:"pt-BR",MXN:"es-MX",RUB:"ru-RU",ZAR:"en-ZA",SEK:"sv-SE",NOK:"nb-NO",DKK:"da-DK",PLN:"pl-PL",TRY:"tr-TR",THB:"th-TH",MYR:"ms-MY",PHP:"en-PH",IDR:"id-ID",CZK:"cs-CZ",HUF:"hu-HU",ILS:"he-IL",TWD:"zh-TW"}[r.toUpperCase()]??"en"}function p(r,n="USD",e){let t=e??i(n);return new Intl.NumberFormat(t,{style:"currency",currency:n}).format(Number(r))}function d(r,n="USD",e){let t=e??i(n);return new Intl.NumberFormat(t,{style:"currency",currency:n,notation:"compact",compactDisplay:"short"}).format(Number(r))}function s(r){let n=/\d+\.\d{3},\d{2}$/.test(r),e=r;n&&(e=r.replace(/\./g,"").replace(",","."));let t=e.replace(/[^0-9.-]+/g,""),c=Number.parseFloat(t);return Number.isNaN(c)?null:c}function f(r){let n={$:"USD","\u20AC":"EUR","\xA3":"GBP","\xA5":"JPY","\u20B9":"INR","\u20BD":"RUB",R$:"BRL","\u20A9":"KRW","\u0E3F":"THB","\u20AA":"ILS","\u20B1":"PHP","\u20AB":"VND",kr:"SEK",CHF:"CHF",C$:"CAD",A$:"AUD",NZ$:"NZD",HK$:"HKD",S$:"SGD"},e=r.match(/\b([A-Z]{3})\b/);if(e&&e[1]){let t=s(r);if(t!==null)return{amount:t,currency:e[1]}}for(let[t,c]of Object.entries(n))if(r.includes(t)){let u=s(r);if(u!==null)return{amount:u,currency:c}}return null}function y(r,n,e=2){return Number.parseFloat((r*n).toFixed(e))}async function g(r){return(await a()).includes(r.toUpperCase())}function b(r){try{return new Intl.NumberFormat("en",{style:"currency",currency:r}),!0}catch{return!1}}function C(r,n=2){let e=10**n;return Math.round(r*e)/e}export{y as convertCurrency,p as formatPrice,d as formatPriceCompact,i as getCurrencyLocale,m as getCurrencyName,l as getCurrencySymbol,b as isValidCurrency,g as isValidCurrencyCode,f as parseCurrencyString,s as parsePrice,C as roundTo};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var R=["CAD","USD","AUD","EUR","GBP","JPY","CHF","CNY","NZD","SGD","SEK","NOK","DKK","MXN","HKD","KRW","TRY","RUB","INR","BRL","ZAR","ILS","MYR","PHP","PLN","THB","TWD","CZK","HUF","IDR","BGN","RON","HRK","BRL","COP","CRC","XCD","XDR","XAG","XAU","XPT","XPD","XTS","XXX"],D=R;export{R as a,D as b};
|