diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-12-27 19:33:54 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-12-27 19:34:16 +0100 |
commit | 0e6de2c31dbf8c21277481f112e99c52b913940f (patch) | |
tree | 91789032de3b8eec9d789acd1323f25fc5d08422 /node_modules/pretty-ms/readme.md | |
parent | ceda0da31ad542c598c68146ae0712ca03df3d71 (diff) | |
download | wallet-core-0e6de2c31dbf8c21277481f112e99c52b913940f.tar.xz |
node_modules
Diffstat (limited to 'node_modules/pretty-ms/readme.md')
-rw-r--r-- | node_modules/pretty-ms/readme.md | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/node_modules/pretty-ms/readme.md b/node_modules/pretty-ms/readme.md index 2a1bf780f..01bab490b 100644 --- a/node_modules/pretty-ms/readme.md +++ b/node_modules/pretty-ms/readme.md @@ -6,11 +6,11 @@ ## Usage ``` -$ npm install --save pretty-ms +$ npm install pretty-ms ``` ```js -var prettyMs = require('pretty-ms'); +const prettyMs = require('pretty-ms'); prettyMs(1337000000); //=> '15d 11h 23m 20s' @@ -37,43 +37,53 @@ prettyMs(new Date(2014, 0, 1, 10, 40) - new Date(2014, 0, 1, 10, 5)) ## API -### prettyMs(milliseconds, [options]) +### prettyMs(input, [options]) -#### milliseconds +#### input -*Required* Type: `number` Milliseconds to humanize. #### options +Type: `Object` + ##### secDecimalDigits -Type: `number` +Type: `number`<br> Default: `1` Number of digits to appear after the seconds decimal point. ##### msDecimalDigits -Type: `number` +Type: `number`<br> Default: `0` Number of digits to appear after the milliseconds decimal point. Useful in combination with [`process.hrtime()`](https://nodejs.org/api/process.html#process_process_hrtime). +##### keepDecimalsOnWholeSeconds + +Type: `boolean`<br> +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. + ##### compact -Type: `boolean` +Type: `boolean`<br> Default: `false` Only show the first unit: `1h 10m` → `~1h`. ##### verbose -Type: `boolean` +Type: `boolean`<br> Default: `false` Use full-length units: `5h 1m 45s` → `5 hours 1 minute 45 seconds` @@ -86,4 +96,4 @@ Use full-length units: `5h 1m 45s` → `5 hours 1 minute 45 seconds` ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT © [Sindre Sorhus](https://sindresorhus.com) |