@naturalcycles/bench-lib 4.8.0 → 4.10.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.
@@ -39,9 +39,9 @@ export function asciiPlot(seriesInput, cfg = {}) {
39
39
  // if (typeof(seriesInput[0]) === "number"){
40
40
  // series = [seriesInput as number[]]
41
41
  // }
42
- cfg = typeof cfg !== 'undefined' ? cfg : {};
43
- let min = typeof cfg.min !== 'undefined' ? cfg.min : series[0][0];
44
- let max = typeof cfg.max !== 'undefined' ? cfg.max : series[0][0];
42
+ cfg = typeof cfg === 'undefined' ? {} : cfg;
43
+ let min = typeof cfg.min === 'undefined' ? series[0][0] : cfg.min;
44
+ let max = typeof cfg.max === 'undefined' ? series[0][0] : cfg.max;
45
45
  for (const element of series) {
46
46
  for (const element_ of element) {
47
47
  min = Math.min(min, element_);
@@ -50,11 +50,11 @@ export function asciiPlot(seriesInput, cfg = {}) {
50
50
  }
51
51
  const defaultSymbols = ['┼', '┤', '╶', '╴', '─', '╰', '╭', '╮', '╯', '│'];
52
52
  const range = Math.abs(max - min);
53
- const offset = typeof cfg.offset !== 'undefined' ? cfg.offset : 3;
54
- const padding = typeof cfg.padding !== 'undefined' ? cfg.padding : ' ';
55
- const height = typeof cfg.height !== 'undefined' ? cfg.height : range;
56
- const colors = typeof cfg.colors !== 'undefined' ? cfg.colors : [];
57
- const ratio = range !== 0 ? height / range : 1;
53
+ const offset = typeof cfg.offset === 'undefined' ? 3 : cfg.offset;
54
+ const padding = typeof cfg.padding === 'undefined' ? ' ' : cfg.padding;
55
+ const height = typeof cfg.height === 'undefined' ? range : cfg.height;
56
+ const colors = typeof cfg.colors === 'undefined' ? [] : cfg.colors;
57
+ const ratio = range === 0 ? 1 : height / range;
58
58
  const min2 = Math.round(min * ratio);
59
59
  const max2 = Math.round(max * ratio);
60
60
  const rows = Math.abs(max2 - min2);
@@ -63,10 +63,10 @@ export function asciiPlot(seriesInput, cfg = {}) {
63
63
  width = Math.max(width, element.length);
64
64
  }
65
65
  width += offset;
66
- const symbols = typeof cfg.symbols !== 'undefined' ? cfg.symbols : defaultSymbols;
67
- const format = typeof cfg.format !== 'undefined'
68
- ? cfg.format
69
- : (x) => (padding + x.toFixed(2)).slice(-padding.length);
66
+ const symbols = typeof cfg.symbols === 'undefined' ? defaultSymbols : cfg.symbols;
67
+ const format = typeof cfg.format === 'undefined'
68
+ ? (x) => (padding + x.toFixed(2)).slice(-padding.length)
69
+ : cfg.format;
70
70
  const result = new Array(rows + 1); // empty space
71
71
  for (let i = 0; i <= rows; i++) {
72
72
  result[i] = new Array(width);
package/package.json CHANGED
@@ -4,13 +4,13 @@
4
4
  "dependencies": {
5
5
  "@naturalcycles/js-lib": "^15",
6
6
  "@naturalcycles/nodejs-lib": "^15",
7
- "autocannon": "^8",
7
+ "autocannon": "^9",
8
8
  "benchmark": "^2",
9
9
  "hdr-histogram-js": "^3",
10
10
  "tslib": "^2"
11
11
  },
12
12
  "devDependencies": {
13
- "@naturalcycles/dev-lib": "0.0.0",
13
+ "@naturalcycles/dev-lib": "20.79.0",
14
14
  "@types/benchmark": "^2",
15
15
  "@types/cors": "^2",
16
16
  "@types/express": "^5",
@@ -40,7 +40,7 @@
40
40
  "engines": {
41
41
  "node": ">=26.12.1"
42
42
  },
43
- "version": "4.8.0",
43
+ "version": "4.10.0",
44
44
  "description": "Benchmarking library, based on Benchmark.js and Autocannon",
45
45
  "author": "Natural Cycles Team",
46
46
  "license": "MIT",