From e30084d232e105a879d13f63870bc2662caeeba0 Mon Sep 17 00:00:00 2001 From: Alexander Shabunevich Date: Mon, 23 Jan 2023 15:59:52 +0300 Subject: [PATCH] Demo of money format simplified --- src/demo/Demo.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/demo/Demo.vue b/src/demo/Demo.vue index 1ec3fa4..0b88ca4 100644 --- a/src/demo/Demo.vue +++ b/src/demo/Demo.vue @@ -43,7 +43,7 @@ const examples = [ }, { label: 'Money format: full via hooks', - code: `const options = {\n preProcess: val => val.replace(/[$,]/g, ''),\n postProcess: val => {\n if (!val) return ''\n\n const sub = 3 - (val.includes('.') ? val.length - val.indexOf('.') : 0)\n\n return Intl.NumberFormat('en-US', {\n style: 'currency',\n currency: 'USD'\n }).formatToParts(val)\n .map(v => v.value)\n .join('')\n .slice(0, sub ? -sub : undefined)\n }\n}\n\n` + code: `const options = {\n preProcess: val => val.replace(/[$,]/g, ''),\n postProcess: val => {\n if (!val) return ''\n\n const sub = 3 - (val.includes('.') ? val.length - val.indexOf('.') : 0)\n\n return Intl.NumberFormat('en-US', {\n style: 'currency',\n currency: 'USD'\n }).format(val)\n .slice(0, sub ? -sub : undefined)\n }\n}\n\n` }, { label: 'Reversed number format with thousand separators',