@vbarbarosh/node-helpers 3.59.0 → 3.60.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.59.0",
5
+ "version": "3.60.0",
6
6
  "description": "A set of helpers for JavaScript/Node.js",
7
7
  "files": [
8
8
  "src"
@@ -0,0 +1,11 @@
1
+ function object_defaults(obj, defaults)
2
+ {
3
+ Object.entries(defaults).forEach(function ([key, value]) {
4
+ if (obj[key] === undefined) {
5
+ obj[key] = value;
6
+ }
7
+ });
8
+ return obj;
9
+ }
10
+
11
+ module.exports = object_defaults;
@@ -12,10 +12,10 @@ const stream = require('stream');
12
12
  *
13
13
  * @similar https://www.npmjs.com/package/progress-stream
14
14
  */
15
- function stream_progress({objectMode = false, total, user_friendly_status = s => console.log(s)} = {})
15
+ function stream_progress({objectMode = false, interval = 1000, total, user_friendly_status = s => console.log(s)} = {})
16
16
  {
17
17
  let done = 0;
18
- const timer = setInterval(tick, 1000);
18
+ const timer = setInterval(tick, interval);
19
19
  const progress = make_progress(total);
20
20
  const format_progress = objectMode ? format_progress_kilo : format_progress_bytes;
21
21
  setTimeout(tick, 0);