【每日一包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 将被其他符号分割的字符串转换为驼峰形式的字符串 用法 ...
随机推荐
- VirtualBox端口映射
问题:VirtualBox里面启动Django项目后发现在虚拟机能打开,在物理机上无法打开如图: 解决方法:端口映射 问题解决!其他端口问题只需要添加对应端口即可,比如xshell连接虚拟机要添加22 ...
- 基于soap 的 python web services 服务开发指南
文章大纲 序言 相关概念 SOA web services SOAP WSDL UDDI 环境搭建 我们使用 python 3.6 这个较新python 版本 服务端开发 客户端开发 suds-jur ...
- LGOJ1290 欧几里德的游戏
题目链接 P1290 and UVA10368 (双倍经验[虽然标签差距很有趣]) 题目大意 给定两个数\(n\)和\(m\),每次操作可以用较大数减去较小数的正整数倍,不可以减成负数. 先获得一个\ ...
- java正则(贪婪、勉强)
贪婪.勉强和侵占量词间的不同 在贪婪.勉强和侵占三个量词间有着细微的不同. 贪婪(*, ?, +):读入整个串,从后往前匹配 勉强(*?, ??, +?):从前往后匹配 侵占(*+, ?+, ++): ...
- PolarDB阿里初赛问题记录 PolarDB 阿里 中间件 比赛 性能 工程手册
Contents 这篇纯碎是碎碎念记录. 每个value都是4KB,总共最多会写6400W个value,算下来就是64 * 1000 * 1000 * 4 * 1024 Bytes ≈ 256G. 每 ...
- OpenCV 级联分类器
#include "opencv2/objdetect/objdetect.hpp" #include "opencv2/highgui/highgui.hpp" ...
- 1005 继续(3n+1)猜想 (25 分)
题目:链接 卡拉兹(Callatz)猜想已经在1001中给出了描述.在这个题目里,情况稍微有些复杂. 当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数.例如对 n=3 ...
- Python:扫描目录下的所有文件
扫描目录下的所有文件并返回文件的绝对路径 def fileListFunc(filePathList): fileList = [] for filePath in filePathList: for ...
- PEAKS|NovoHMM|Nover|DeepNovo|MAYUPercolator|UniprotKB|Swiss-prot|Mascot|SEQUEST|X!Tandem|pFind|MaxQuant|Msconvert|PEPMASS|LC|
质谱仪: 质谱分析法是先将大分子电离为带电粒子,按质核比分离,由质谱仪识别电信号得到质谱图. Top-down直接得到结果是蛋白. Bottom down使用shutgun方法得到结果是肽段. 由蛋白 ...
- spring security之Remember Me
spring-security.xml配置 环境: spring版本:5.0.7.RELEASE spring-security.xml引入: http://www.springframework.o ...