@gem-sdk/core 3.1.0 → 3.1.2

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.
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var shop=require("./shop.js");const shopifyPriceRounding=(e,a)=>parseFloat(`${e}`).toFixed(Number(a)),formatMoney=function(e,a){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t=a||"${{amount}}";function s(e,a){return void 0===e?a:e}function n(e,a,o,r){if(a=s(a,2),o=s(o,","),r=s(r,"."),isNaN(e)||null==e)return 0;e=shopifyPriceRounding(e,Number(a));let t=e.split("."),n=t[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),i=t[1]?r+t[1]:"";return n+i}switch(t.match(r)[1]){case"amount":o=n(e,2);break;case"amount_no_decimals":o=n(e,0);break;case"amount_with_comma_separator":o=n(e,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=n(e,0,".",",");break;case"amount_with_apostrophe_separator":o=n(e,2,"'",".");break;case"amount_no_decimals_with_space_separator":o=n(e,0," ");break;case"amount_with_space_separator":o=n(e,2," ",",");break;case"amount_with_period_and_space_separator":o=n(e,2," ",".")}return t.replace(r,o)},useFormatMoney=(e,a)=>{let{moneyFormat:o,moneyWithCurrencyFormat:r}=shop.useMoneyFormat();return a?formatMoney(`${e}`,r||o):formatMoney(`${e}`,o)};exports.formatMoney=formatMoney,exports.shopifyPriceRounding=shopifyPriceRounding,exports.useFormatMoney=useFormatMoney;
2
+ "use strict";var shop=require("./shop.js");const shopifyPriceRounding=(e,a)=>parseFloat(`${e}`).toFixed(Number(a)),formatMoney=function(e,a){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t="string"!=typeof a?a:a.replace(/<[^>]*>/g,""),s=t||"${{amount}}";function n(e,a){return void 0===e?a:e}function i(e,a,o,r){if(a=n(a,2),o=n(o,","),r=n(r,"."),isNaN(e)||null==e)return 0;e=shopifyPriceRounding(e,Number(a));let t=e.split("."),s=t[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),i=t[1]?r+t[1]:"";return s+i}let u=s.match(r);if(!u)return s;switch(u[1]){case"amount":o=i(e,2);break;case"amount_no_decimals":o=i(e,0);break;case"amount_with_comma_separator":o=i(e,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=i(e,0,".",",");break;case"amount_with_apostrophe_separator":o=i(e,2,"'",".");break;case"amount_no_decimals_with_space_separator":o=i(e,0," ");break;case"amount_with_space_separator":o=i(e,2," ",",");break;case"amount_with_period_and_space_separator":o=i(e,2," ",".")}return s.replace(r,o)},useFormatMoney=(e,a)=>{let{moneyFormat:o,moneyWithCurrencyFormat:r}=shop.useMoneyFormat();return a?formatMoney(`${e}`,r||o):formatMoney(`${e}`,o)};exports.formatMoney=formatMoney,exports.shopifyPriceRounding=shopifyPriceRounding,exports.useFormatMoney=useFormatMoney;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{useMoneyFormat as a}from"./shop.js";let shopifyPriceRounding=(a,e)=>parseFloat(`${a}`).toFixed(Number(e)),formatMoney=function(a,e){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t=e||"${{amount}}";function n(a,e){return void 0===a?e:a}function s(a,e,o,r){if(e=n(e,2),o=n(o,","),r=n(r,"."),isNaN(a)||null==a)return 0;a=shopifyPriceRounding(a,Number(e));let t=a.split("."),s=t[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),i=t[1]?r+t[1]:"";return s+i}switch(t.match(r)[1]){case"amount":o=s(a,2);break;case"amount_no_decimals":o=s(a,0);break;case"amount_with_comma_separator":o=s(a,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=s(a,0,".",",");break;case"amount_with_apostrophe_separator":o=s(a,2,"'",".");break;case"amount_no_decimals_with_space_separator":o=s(a,0," ");break;case"amount_with_space_separator":o=s(a,2," ",",");break;case"amount_with_period_and_space_separator":o=s(a,2," ",".")}return t.replace(r,o)},useFormatMoney=(e,o)=>{let{moneyFormat:r,moneyWithCurrencyFormat:t}=a();return o?formatMoney(`${e}`,t||r):formatMoney(`${e}`,r)};export{formatMoney,shopifyPriceRounding,useFormatMoney};
2
+ import{useMoneyFormat as e}from"./shop.js";let shopifyPriceRounding=(e,a)=>parseFloat(`${e}`).toFixed(Number(a)),formatMoney=function(e,a){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t="string"!=typeof a?a:a.replace(/<[^>]*>/g,""),n=t||"${{amount}}";function s(e,a){return void 0===e?a:e}function i(e,a,o,r){if(a=s(a,2),o=s(o,","),r=s(r,"."),isNaN(e)||null==e)return 0;e=shopifyPriceRounding(e,Number(a));let t=e.split("."),n=t[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),i=t[1]?r+t[1]:"";return n+i}let c=n.match(r);if(!c)return n;switch(c[1]){case"amount":o=i(e,2);break;case"amount_no_decimals":o=i(e,0);break;case"amount_with_comma_separator":o=i(e,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=i(e,0,".",",");break;case"amount_with_apostrophe_separator":o=i(e,2,"'",".");break;case"amount_no_decimals_with_space_separator":o=i(e,0," ");break;case"amount_with_space_separator":o=i(e,2," ",",");break;case"amount_with_period_and_space_separator":o=i(e,2," ",".")}return n.replace(r,o)},useFormatMoney=(a,o)=>{let{moneyFormat:r,moneyWithCurrencyFormat:t}=e();return o?formatMoney(`${a}`,t||r):formatMoney(`${a}`,r)};export{formatMoney,shopifyPriceRounding,useFormatMoney};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",