Gathering detailed insights and metrics for pretty-ms-i18n
Gathering detailed insights and metrics for pretty-ms-i18n
Gathering detailed insights and metrics for pretty-ms-i18n
Gathering detailed insights and metrics for pretty-ms-i18n
npm install pretty-ms-i18n
Typescript
Module System
Min. Node Version
Node Version
NPM Version
72
Supply Chain
99.3
Quality
77.8
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
74,290
Last Day
55
Last Week
429
Last Month
2,550
Last Year
28,241
83 Commits
1 Forks
1 Watching
14 Branches
24 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.3
Package Id
pretty-ms-i18n@1.0.3
Unpacked Size
12.50 kB
Size
4.51 kB
File Count
8
NPM Version
6.14.8
Node Version
12.12.0
Cumulative downloads
Total Downloads
Last day
-28.6%
55
Compared to previous day
Last week
-40.5%
429
Compared to previous week
Last month
-25.3%
2,550
Compared to previous month
Last year
27.8%
28,241
Compared to previous year
1
Convert milliseconds to a human readable string:
1337000000
→15d 11h 23m 20s
$ npm install pretty-ms
1const prettyMilliseconds = require('pretty-ms'); 2 3prettyMilliseconds(1337000000); 4//=> '15d 11h 23m 20s' 5 6prettyMilliseconds(1337); 7//=> '1.3s' 8 9prettyMilliseconds(133); 10//=> '133ms' 11 12// `compact` option 13prettyMilliseconds(1337, { compact: true }); 14//=> '1s' 15 16// `locale` option default en_US 17prettyMilliseconds(1337, { locale: 'zh_CN' }); 18//=> '1秒' 19 20// `verbose` option 21prettyMilliseconds(1335669000, { verbose: true }); 22//=> '15 days 11 hours 1 minute 9 seconds' 23 24// `colonNotation` option 25prettyMilliseconds(95500, { colonNotation: true }); 26//=> '1:35.5' 27 28// `formatSubMilliseconds` option 29prettyMilliseconds(100.40008, { formatSubMilliseconds: true }); 30//=> '100ms 400µs 80ns' 31 32// Can be useful for time durations 33prettyMilliseconds(new Date(2014, 0, 1, 10, 40) - new Date(2014, 0, 1, 10, 5)); 34//=> '35m'
Type: number
Milliseconds to humanize.
Type: object
Type: string
Default: en_US
you can use 'en_US' or 'zh_CN' to show i18n. Detail to see
Only show: 1s
→ 1秒
.
Type: number
Default: 1
Number of digits to appear after the seconds decimal point.
Type: number
Default: 0
Number of digits to appear after the milliseconds decimal point.
Useful in combination with process.hrtime()
.
Type: boolean
Default: false
Keep milliseconds on whole seconds: 13s
→ 13.0s
.
Useful when you are showing a number of seconds spent on an operation and don't want the width of the output to change when hitting a whole number.
Type: boolean
Default: false
Only show the first unit: 1h 10m
→ 1h
.
Also ensures that millisecondsDecimalDigits
and secondsDecimalDigits
are both set to 0
.
Type: number
Default: Infinity
Number of units to show. Setting compact
to true
overrides this option.
Type: boolean
Default: false
Use full-length units: 5h 1m 45s
→ 5 hours 1 minute 45 seconds
Type: boolean
Default: false
Show milliseconds separately. This means they won't be included in the decimal part of the seconds.
Type: boolean
Default: false
Show microseconds and nanoseconds.
Type: boolean
Default: false
Display time using colon notation: 5h 1m 45s
→ 5:01:45
. Always shows time in at least minutes: 1s
→ 0:01
Useful when you want to display time without the time units, similar to a digital watch.
Setting colonNotation
to true
overrides the following options to false
:
compact
formatSubMilliseconds
separateMilliseconds
verbose
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
28 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More