convert: common/utils/formatNumber

This commit is contained in:
David Sevilla Martin 2020-06-21 19:06:06 -04:00 committed by Franz Liedke
parent 79bdff96c1
commit f1e574d843

View File

@ -5,10 +5,7 @@
* @example
* formatNumber(1234);
* // 1,234
*
* @param {Number} number
* @return {String}
*/
export default function formatNumber(number) {
export default function formatNumber(number: number): string {
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}