numerify

numerify

numerify
用来格式化值的一个工具,官方介绍This is a formatted value tool that makes formatting easier and more convenient to extend.

可以转数值类型,比如

NumberFormatString
10000‘0,0.0000’10,000.0000
10000.23‘0,0’10,000
10000.23‘+0,0’+10,000
-10000‘0,0.0’-10,000.0
10000.1234‘0.000’10000.123
100.1234‘00000’00100
1000.1234‘000000,0’001,000
10‘000.00’010.00
10000.1234‘0[.]00000’10000.12340
-10000‘(0,0.0000)’(10,000.0000)
-0.23‘.00’-.23
-0.23‘(.00)’(.23)
0.23‘0.00000’0.23000
0.23‘0.0[0000]’0.23
1230974‘0.0a’1.2m
1460‘0 a’1 k
-104000‘0a’-104k
1‘0%’100%
0.974878234‘0.000%’97.488%
-0.43‘0 %’-43 %
0.43‘(0.000 %)’43.000 %

调用的方法

numerify(number, formatter, roundFunction)

Plugins

bps

NumberFormatString
0‘0 BPS’0 BPS
0.0001‘0 BPS’1 BPS
.0056‘0 BPS’56 BPS
.25‘0BPS’2500BPS
.000001‘0.00 BPS’0.01 BPS

bytes

NumberFormatString
100‘0b’100B
1024‘0b’1KB
2048‘0 ib’2 KiB
3072‘0.0 b’3.1 KB
7884486213‘0.00b’7.88GB
3467479682787‘0.000 ib’3.154 TiB

exponential

ordinal

time

NumberFormatString
25‘00:00:00’0:00:25
238‘00:00:00’0:03:58
63846‘00:00:00’17:44:06
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值