aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/utils.js')
-rw-r--r--src/lib/utils.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js
index 69606d36..70ea5d3b 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -74,6 +74,12 @@ export let copy = (text) => {
success('Copied!');
};
+export let copyNoNewlines = (text) => {
+ let stripped = text.replace(/\n/g, ' ').replace(/\s+/g, ' ');
+ navigator.clipboard.writeText(stripped);
+ success('Copied!');
+};
+
export function reverseFormat(val, locale) {
let parts = new Intl.NumberFormat(locale).formatToParts(1111.1);
let group = parts.find((part) => part.type === 'group').value;