aboutsummaryrefslogtreecommitdiff
path: root/util/helperFunctions.js
diff options
context:
space:
mode:
Diffstat (limited to 'util/helperFunctions.js')
-rw-r--r--util/helperFunctions.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/util/helperFunctions.js b/util/helperFunctions.js
new file mode 100644
index 0000000..2bea5d0
--- /dev/null
+++ b/util/helperFunctions.js
@@ -0,0 +1,10 @@
+/*
+Created 11/11/2022 by Ninjune.
+*/
+export function addCommas(num) {
+ try {
+ return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
+ } catch (error) {
+ return 0;
+ }
+}// credit to senither for the regex, just don't care to make my own lol \ No newline at end of file