@vbarbarosh/node-helpers 3.38.0 → 3.38.1

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.38.0",
5
+ "version": "3.38.1",
6
6
  "description": "A set of helpers for JavaScript/Node.js",
7
7
  "files": [
8
8
  "src"
@@ -11,7 +11,7 @@ function format_kilo(num)
11
11
  return num.toString();
12
12
  }
13
13
  const i = parseInt(Math.floor(Math.log(num) / Math.log(1000)), 10);
14
- return `${(num / (1000 ** i)).toFixed(2)}`.replace(/0$/, '').replace(/\.0$/, '') + sizes[i];
14
+ return `${(num / (1000 ** i)).toFixed(2)}${sizes[i]}`;
15
15
  }
16
16
 
17
17
  module.exports = format_kilo;
@@ -8,8 +8,8 @@ const items = [
8
8
  [0, '0'],
9
9
  [1, '1'],
10
10
  [900, '900'],
11
- [1500, '1.5K'],
12
- [2000, '2K'],
11
+ [1500, '1.50K'],
12
+ [2000, '2.00K'],
13
13
  [35.45*1000*1000, '35.45M'],
14
14
  [3.92*1000*1000*1000, '3.92G'],
15
15
  ];
@@ -4,10 +4,10 @@ const format_progress_kilo = require('./format_progress_kilo');
4
4
  const items = [
5
5
  ['~', {percents: 0, total: 0, done: 0, rate: 0, eta: 0, duration: 0}],
6
6
  ['~ duration=00:00:01', {percents: 0, total: 0, done: 0, rate: 0, eta: 0, duration: 1}],
7
- ['25.25% | 5M of 15M at ~ ETA ~ duration=00:00:01', {percents: 0.2525, total: 15*1000*1000, done: 5*1000*1000, rate: 0, eta: 0, duration: 1}],
8
- ['25.25% | 5M of 15M at 10M/s ETA 00:00:05 duration=00:00:01', {percents: 0.2525, total: 15*1000*1000, done: 5*1000*1000, rate: 10*1000*1000, eta: 5, duration: 1}],
7
+ ['25.25% | 5.00M of 15.00M at ~ ETA ~ duration=00:00:01', {percents: 0.2525, total: 15*1000*1000, done: 5*1000*1000, rate: 0, eta: 0, duration: 1}],
8
+ ['25.25% | 5.00M of 15.00M at 10.00M/s ETA 00:00:05 duration=00:00:01', {percents: 0.2525, total: 15*1000*1000, done: 5*1000*1000, rate: 10*1000*1000, eta: 5, duration: 1}],
9
9
  // edge case: done > total
10
- ['15M at 10M/s duration=00:00:01', {percents: 5.2525, total: 5*1000*1000, done: 15*1000*1000, rate: 10*1000*1000, eta: 5, duration: 1}],
10
+ ['15.00M at 10.00M/s duration=00:00:01', {percents: 5.2525, total: 5*1000*1000, done: 15*1000*1000, rate: 10*1000*1000, eta: 5, duration: 1}],
11
11
  ];
12
12
 
13
13
  describe('format_progress_kilo', function () {