const toThousands = (price) => {
return price.replace(new RegExp(`(?!^)(?=(d{3})+${price.includes('.') ? '.' : '$'})`, 'g'), ',')
}
toThousands('123456789') // '123,456,789'
toThousands('123456789.123') // '123,456,789.123'
toThousands('123') // '123'