@vbarbarosh/node-helpers 3.43.0 → 3.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Vladimir Barbarosh <vladimir.barbarosh@gmail.com>",
3
3
  "license": "MIT",
4
4
  "name": "@vbarbarosh/node-helpers",
5
- "version": "3.43.0",
5
+ "version": "3.44.0",
6
6
  "description": "A set of helpers for JavaScript/Node.js",
7
7
  "files": [
8
8
  "src"
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Return a human-readable representation of hrtime (the return value from `process.hrtime(hrtime0)`).
3
+ */
4
+ function format_hrtime(hrtime, digits = 6)
5
+ {
6
+ const [u, v] = hrtime; // process.hrtime(hrtime0)
7
+ return (u + v/1E9).toFixed(digits) + 's';
8
+ }
9
+
10
+ module.exports = format_hrtime;
@@ -2,7 +2,7 @@ const format_hrtime = require('./format_hrtime');
2
2
 
3
3
  function perf_end_human(time0, digits = 4)
4
4
  {
5
- return format_hrtime(time0, digits);
5
+ return format_hrtime(process.hrtime(time0), digits);
6
6
  }
7
7
 
8
8
  module.exports = perf_end_human;