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 36eb5cc5fb
commit bdb759c558
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4

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, ',');
}