@rtorcato/js-common 1.5.0 → 1.7.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 +20 -0
- package/dist/currency/index.js +1 -1
- package/dist/helloworld/index.js +1 -0
- package/dist/strings/index.js +1 -1
- package/dist/uuid/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# [1.7.0](https://github.com/rtorcato/js-common/compare/v1.6.0...v1.7.0) (2026-01-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **strings:** add 12 new string utility functions ([03df6fc](https://github.com/rtorcato/js-common/commit/03df6fc4168c1343be47434a2b4c842be394f61c))
|
|
7
|
+
|
|
8
|
+
# [1.6.0](https://github.com/rtorcato/js-common/compare/v1.5.0...v1.6.0) (2026-01-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* added dev branch to CI ([751f124](https://github.com/rtorcato/js-common/commit/751f124d48e40452c43f70ce05239f220bd30c63))
|
|
14
|
+
* update packages and add fix for biome sorting ([0ed384c](https://github.com/rtorcato/js-common/commit/0ed384cfed2e4b285752a8e22f59aebd8ccb19c9))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **uuid:** add v7, version detection, and short UUID conversion ([d304168](https://github.com/rtorcato/js-common/commit/d304168206152b125ffb2269c1c0cc448f266d76))
|
|
20
|
+
|
|
1
21
|
# [1.5.0](https://github.com/rtorcato/js-common/compare/v1.4.2...v1.5.0) (2026-01-16)
|
|
2
22
|
|
|
3
23
|
|
package/dist/currency/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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?.[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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function l(){return"Hello, World!"}export{l as helloWorld};
|
package/dist/strings/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";function
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function s(r){return r.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase())}function o(r){return r.length===0?"":(r[0]?.toUpperCase()??"")+r.slice(1)}function g(r){return r.replace(/[-_\s]+(.)?/g,(t,e)=>e?e.toUpperCase():"").replace(/^(.)/,t=>t.toLowerCase())}function a(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function p(r){return r.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function c(r,t){return r.length>t?`${r.slice(0,t-1)}\u2026`:r}function u(r,t,e=" "){return r.padStart(t,e)}function l(r,t,e=" "){return r.padEnd(t,e)}var f=(r,t)=>{let e="";for(let n=r;n>0;--n)e+=t[Math.floor(Math.random()*t.length)];return e},x=(r,t,e)=>r.replace(new RegExp(t,"g"),e);function m(r){return r.replace(/<script.*?>.*?<\/script>/gi,"").replace(/on\w+\s*=\s*(['"]).*?\1/gi,"")}function b(r){return[...r].reverse().join("")}function $(r){return r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/[\s_]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function h(r){return r.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").trim().split(/\s+/).filter(Boolean)}function w(r){let t=r.trim();return t===""?0:t.split(/\s+/).length}function d(r){let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return r.replace(/[&<>"']/g,e=>t[e]??e)}function C(r){let t={"&":"&","<":"<",">":">",""":'"',"'":"'","'":"'","/":"/"," ":" "};return r.replace(/&(?:amp|lt|gt|quot|#39|#x27|#x2F|nbsp);/g,e=>t[e]??e)}function z(r){return r.replace(/<[^>]*>/g,"")}function S(r,t,e){return t===1?r:e??`${r}s`}function _(r){let t=Math.abs(r),e=t%100,n=t%10;if(e>=11&&e<=13)return`${r}th`;switch(n){case 1:return`${r}st`;case 2:return`${r}nd`;case 3:return`${r}rd`;default:return`${r}th`}}function k(r){return r.trim().length===0}function A(r,t,e,n="*"){if(t<0&&(t=0),e>r.length&&(e=r.length),t>=e)return r;let i=n.repeat(e-t);return r.slice(0,t)+i+r.slice(e)}function E(r,t){return r.replace(/\$\{(\w+)\}/g,(e,n)=>Object.hasOwn(t,n)?String(t[n]):e)}export{g as camelCase,o as capitalize,d as escapeHtml,k as isBlank,a as kebabCase,A as mask,_ as ordinalize,l as padEnd,u as padStart,S as pluralize,f as randomString,x as replaceString,b as reverse,m as sanitizeString,$ as slugify,p as snakeCase,z as stripHtml,E as template,s as titleCase,c as truncate,C as unescapeHtml,w as wordCount,h as words};
|
package/dist/uuid/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";import
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";import i from"short-uuid";import{NIL as n,parse as e,stringify as U,validate as r,version as s,v4 as a,v7 as g}from"uuid";var o=i(),p=()=>a(),D=()=>g(),c=()=>o.new(),x=t=>o.fromUUID(t),d=t=>o.toUUID(t),l=t=>r(t),v=t=>r(t)&&s(t)===4,f=t=>t===n,m=t=>{if(!r(t))throw new Error("Invalid UUID");return s(t)},y=()=>n,b=t=>e(t),h=t=>U(t);export{h as bytesToUUID,d as fromShortUUID,y as getNilUUID,c as getShortUUID,p as getUUID,m as getUUIDVersion,D as getUUIDv7,f as isNilUUID,l as isUUID,v as isUUIDv4,x as toShortUUID,b as uuidToBytes};
|