【每日一包0017】pretty-ms
[github地址:https://github.com/ABCDdouyae...]
pretty-ms
将毫秒转换为容易读取的时间:1337000000 → 15d 11h 23m 20s
普通用法
用法:prettyMs(milliseconds)
返回:string
第二参数用法
用法:prettyMs(milliseconds, options|object)
返回:string
- secDecimalDigits:秒数后面保留的小数点位数,默认1
prettyMs(21312, {secDecimalDigits: 2});//21.32s
- msDecimalDigits:毫秒后面保留的小数点位数,默认0,与process.hrtime()结合使用
- keepDecimalsOnWholeSeconds:保证输出的秒数宽度不变,默认false
prettyMs(20000, {keepDecimalsOnWholeSeconds: true });
//20.0s
- compact:仅展示第一个单位的值,默认false
prettyMs(123232, {compact: true});//~2m
- unitCount:要展示的单位个数,compact为true会覆盖此选项,默认:infinity
prettyMs(12312312, {unitCount: 2})//~3h 25m
- verbose:使用全拼的单位,默认false
prettyMs(12312312, {verbose: true});
// 3 hours 25 minutes 12.3 seconds
- separateMs:最小单位为毫秒数,默认false
prettyMs(12312312, {separateMs: true});// 3h 25m 12s 312ms
- formatSubMs: 显示微秒和纳秒部分,默认false
prettyMs(12312312.12323, {formatSubMs: true});//3h 25m 12s 312ms 123µs 230ns
prettyMs(12312312.12323, {formatSubMs: true, verbose: true});
//3 3 hours 25 minutes 12 seconds 312 milliseconds 123 microseconds 230 nanoseconds【每日一包0017】pretty-ms的更多相关文章
- 【每日一包0005】arr-flatten
github地址:https://github.com/ABCDdouyae... arr-flatten 将多维数组展开成一维数组 文档地址:https://www.npmjs.com/packag ...
- 【每日一包0018】fecha
[github地址:https://github.com/ABCDdouyae...] fecha 比moment.js更加轻量级的时间解析和格式化包 format 用法:format(<Dat ...
- 【每日一包0011】pad
[github地址:https://github.com/ABCDdouyae...] pad 给字符串的左右加padding,也可以用于删减字符串两端 用法:pad(str, length, opt ...
- 【每日一包0015】gradient-string
[github地址:https://github.com/ABCDdouyae...] gradient-string 用于在终端打印出好看的渐变文字 普通用法 console.log(gradien ...
- 【每日一包0001】is-sorted
github地址:https://github.com/ABCDdouyae... is-sorted 用于判断数组是否被排序了 文档地址:https://www.npmjs.com/package/ ...
- 【每日一包0003】kind-of
github地址:https://github.com/ABCDdouyae... kind-of 判断数据类型用法:kind-of(date)返回:string 数据类型 January undef ...
- 【每日一包0008】arr-diff
[github地址:https://github.com/ABCDdouyae...] arr-diff 多个数组比较,过滤出第一个数组独有的内容 用法:arr-diff(arr1, arr2, ar ...
- 【每日一包0009】group-array
[github地址:https://github.com/ABCDdouyae...] group-array 对数组里面的多项按照指定的key进行整合 用法:group-array(arr, key ...
- 【每日一包0012】to-camel-case,to-no-case,to-space-case
github地址:https://github.com/ABCDdouyaer/a_pack_per_day_NO.1 to-camel-case 将被其他符号分割的字符串转换为驼峰形式的字符串 用法 ...
随机推荐
- HDU-4553 约会安排(线段树维护连续区间)
http://acm.hdu.edu.cn/showproblem.php?pid=4553 Problem Description 寒假来了,又到了小明和女神们约会的季节. 小明虽为屌丝级码农,但 ...
- python-django电商项目-需求分析架构设计数据库设计_20191115
python-django电商项目需求分析 1.用户模块 1)注册页 注册时校验用户名是否已被注册. 完成用户信息的注册. 给用户的注册邮箱发送邮件,用户点击邮件中的激活链接完成用户账户的激活. 2) ...
- Invert Binary Tree(easy)
1.直接把递归把左右子树翻转即可 AC代码: /** * Definition for a binary tree node. * struct TreeNode { * int val; * Tre ...
- android完整资讯App、Kotlin新闻应用MVP + RxJava + Retrofit + Dagger2、优雅区间选择器等源码
Android精选源码 Android完整资讯客户端源码 android展示注册进度效果源码 Android Wifi热点数据传输Socket 通信示例源码 Android Dota的辅助信息app源 ...
- ckeditor深入挖掘吃透
- put out|smashed|As soon as|provided
CONJ-SUBORD 如果:假如:只要If you say that something will happen provided or provided that something else h ...
- made his acquaintance|adequate|advisable|announce|contrived to|made up|toss|considering that
PHRASE 与(某人)初次相识;结识(某人)When you make someone's acquaintance, you meet them for the first time and ge ...
- Spring MVC及与structs MVC对比
一.Spring MVC MVC: Model + View + Controller(数据模型+视图+控制器) 三层架构: Presentation tier + Application tier ...
- Linux主机下如何查询自己使用的公网IP
curl http://members.3322.org/dyndns/getip 可以解析出自己是使用哪个公网IP访问外网的
- 使用junit测试springMVC项目提示ServletContext找不到定义错误
原文链接:https://blog.csdn.net/liu_gan/article/details/78400627 @RunWith(SpringJUnit4ClassRunner.class) ...