extract out function

This commit is contained in:
counterweight 2025-03-15 14:56:51 +01:00
parent 2b7b761737
commit 4ee00edb04
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
2 changed files with 7 additions and 4 deletions

View file

@ -1,8 +1,6 @@
function offersPage() {
function formatNumberWithSpaces(num) {
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
}
const formatNumberWithSpaces = require('../utils/formatNumbersWithSpaces');
function offersPage() {
const navbuttonHome = document.getElementById('navbutton-home');
const navbuttonOffers = document.getElementById('navbutton-offers');

View file

@ -0,0 +1,5 @@
function formatNumberWithSpaces(num) {
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
}
module.exports = formatNumberWithSpaces;