Socket
Socket
Sign inDemoInstall

humanize-duration

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

humanize-duration - npm Package Compare versions

Comparing version 3.17.0 to 3.18.0

5

HISTORY.md

@@ -0,1 +1,6 @@

3.18.0 / 2019-03-07
===================
* new: `maxDecimalPoints` option
3.17.0 / 2019-01-06

@@ -2,0 +7,0 @@ ===================

9

humanize-duration.js

@@ -545,3 +545,10 @@ // HumanizeDuration.js - https://git.io/j0HgmQ

if (i + 1 === len) {
unitCount = ms / unitMS
if (options.hasOwnProperty('maxDecimalPoints')) {
// We need to use this expValue to avoid rounding functionality of toFixed call
var expValue = Math.pow(10, options.maxDecimalPoints)
var unitCountFloat = (ms / unitMS)
unitCount = parseFloat((Math.floor(expValue * unitCountFloat) / expValue).toFixed(options.maxDecimalPoints))
} else {
unitCount = ms / unitMS
}
} else {

@@ -548,0 +555,0 @@ unitCount = Math.floor(ms / unitMS)

6

package.json

@@ -29,3 +29,3 @@ {

],
"version": "3.17.0",
"version": "3.18.0",
"description": "Convert millisecond durations to English and many other languages.",

@@ -40,5 +40,5 @@ "homepage": "https://github.com/EvanHahn/HumanizeDuration.js",

"check-ecmascript-version-compatibility": "^0.1.1",
"csv-parse": "^1.1.7",
"csv-parse": "^4.3.1",
"mocha": "^5.2.0",
"ms": "^0.7.2",
"ms": "^2.1.1",
"standard": "^12.0.1"

@@ -45,0 +45,0 @@ },

@@ -132,2 +132,14 @@ Humanize Duration

**maxDecimalPoints**
Number that defines a maximal decimal points for float values.
```js
humanizeDuration(8123.456789) // 8.12 seconds
humanizeDuration(8123.456789, { maxDecimalPoints: 3 }) // 8.123 seconds
humanizeDuration(8123.456789, { maxDecimalPoints: 6 }) // 8.123456 seconds
humanizeDuration(8123.45, { maxDecimalPoints: 6 }) // 8.12345 seconds
humanizeDuration(8000, { maxDecimalPoints: 6 }) // 8 seconds
```
**unitMeasures**

@@ -134,0 +146,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc