UNPKG
always-helper
Version:
latest (0.0.11)
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
前端项目开发中,经常会用到一些工具函数的合集。
github.com/Rabbitzzc/always
Rabbitzzc/always
always-helper
/
lib
/
number
/
commafy.js
2 lines
(1 loc)
•
201 B
JavaScript
View Raw
1
2
export
default
function
(e){var t=e.toString().
split
(
"."
);
return
t[0].length>=4&&(t[0]=t[0].replace(/(\d)(?=(\d{3})+$)/g,
"
$1
,"
)),t[1]&&t[1].length>=4&&(t[1]=t[1].replace(/(\d{3})/g,
"
$1
"
)),t.join(
"."
)}