@jsenv/humanize 1.0.0 → 1.1.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.
Files changed (39) hide show
  1. package/README.md +25 -10
  2. package/dist/browser/jsenv_humanize_browser.js +76 -2
  3. package/dist/node/jsenv_humanize_node.js +73 -147
  4. package/package.json +3 -3
  5. package/src/.jsenv/jsenv_tests_output.txt +26 -29
  6. package/src/_tests/byte/file_size.test.js +2 -2
  7. package/src/_tests/byte/memory.test.js +11 -0
  8. package/src/_tests/js_value/array.test.js +14 -14
  9. package/src/_tests/js_value/biginit.test.js +10 -10
  10. package/src/_tests/js_value/boolean.test.js +12 -12
  11. package/src/_tests/js_value/date.test.js +4 -4
  12. package/src/_tests/js_value/error.test.js +8 -8
  13. package/src/_tests/js_value/function.test.js +12 -12
  14. package/src/_tests/js_value/instance.test.js +2 -2
  15. package/src/_tests/js_value/null.test.js +2 -2
  16. package/src/_tests/js_value/number.test.js +54 -54
  17. package/src/_tests/js_value/object.test.js +34 -34
  18. package/src/_tests/js_value/regexp.test.js +4 -4
  19. package/src/_tests/js_value/string.test.js +32 -32
  20. package/src/_tests/js_value/symbol.test.js +6 -6
  21. package/src/_tests/js_value/undefined.test.js +2 -2
  22. package/src/_tests/log/logger.test.mjs +14 -14
  23. package/src/_tests/log/spinner.test.mjs +6 -6
  24. package/src/_tests/percentage/percentage_distribution.test.mjs +2 -2
  25. package/src/_tests/time/decimals.test.js +40 -40
  26. package/src/_tests/time/duration.test.js +2 -2
  27. package/src/_tests/time/ellapsed.test.js +2 -2
  28. package/src/byte/byte.js +1 -1
  29. package/src/js_value/humanize.js +1 -1
  30. package/src/log/ansi_browser.js +27 -0
  31. package/src/log/{ansi.js → ansi_node.js} +7 -2
  32. package/src/log/dynamic_log.js +6 -4
  33. package/src/log/spinner.js +1 -1
  34. package/src/log/task_log.js +1 -1
  35. package/src/log/unicode_browser.js +53 -0
  36. package/src/log/{unicode.js → unicode_node.js} +4 -1
  37. package/src/main_browser.js +4 -1
  38. package/src/main_node.js +3 -3
  39. package/src/_tests/byte/memory_usage.test.js +0 -11
@@ -3,104 +3,104 @@ import { humanize } from "@jsenv/humanize";
3
3
 
4
4
  {
5
5
  const actual = humanize(String.fromCharCode(127));
6
- const expected = `"\\x7F"`;
7
- assert({ actual, expected });
6
+ const expect = `"\\x7F"`;
7
+ assert({ actual, expect });
8
8
  }
9
9
 
10
10
  {
11
11
  const actual = humanize("");
12
- const expected = `""`;
13
- assert({ actual, expected });
12
+ const expect = `""`;
13
+ assert({ actual, expect });
14
14
  }
15
15
 
16
16
  {
17
17
  const actual = humanize("dam");
18
- const expected = `"dam"`;
19
- assert({ actual, expected });
18
+ const expect = `"dam"`;
19
+ assert({ actual, expect });
20
20
  }
21
21
 
22
22
  {
23
23
  const actual = humanize("don't");
24
- const expected = `"don't"`;
25
- assert({ actual, expected });
24
+ const expect = `"don't"`;
25
+ assert({ actual, expect });
26
26
  }
27
27
 
28
28
  {
29
29
  const actual = humanize("don't", { quote: "'" });
30
- const expected = `'don\\\'t'`;
31
- assert({ actual, expected });
30
+ const expect = `'don\\\'t'`;
31
+ assert({ actual, expect });
32
32
  }
33
33
 
34
34
  {
35
35
  const actual = humanize(`his name is "dam"`);
36
- const expected = `'his name is "dam"'`;
37
- assert({ actual, expected });
36
+ const expect = `'his name is "dam"'`;
37
+ assert({ actual, expect });
38
38
  }
39
39
 
40
40
  {
41
41
  const actual = humanize(`his name is "dam"`, { quote: "'" });
42
- const expected = `'his name is "dam"'`;
43
- assert({ actual, expected });
42
+ const expect = `'his name is "dam"'`;
43
+ assert({ actual, expect });
44
44
  }
45
45
 
46
46
  {
47
47
  const actual = humanize("a\nb");
48
- const expected = `"a\\nb"`;
49
- assert({ actual, expected });
48
+ const expect = `"a\\nb"`;
49
+ assert({ actual, expect });
50
50
  }
51
51
 
52
52
  {
53
53
  const actual = humanize("a\rb");
54
- const expected = `"a\\rb"`;
55
- assert({ actual, expected });
54
+ const expect = `"a\\rb"`;
55
+ assert({ actual, expect });
56
56
  }
57
57
 
58
58
  {
59
59
  const actual = humanize("a\u2028b");
60
- const expected = `"a\\u2028b"`;
61
- assert({ actual, expected });
60
+ const expect = `"a\\u2028b"`;
61
+ assert({ actual, expect });
62
62
  }
63
63
 
64
64
  {
65
65
  const actual = humanize("a\u2029b");
66
- const expected = `"a\\u2029b"`;
67
- assert({ actual, expected });
66
+ const expect = `"a\\u2029b"`;
67
+ assert({ actual, expect });
68
68
  }
69
69
 
70
70
  {
71
71
  // eslint-disable-next-line no-new-wrappers
72
72
  const actual = humanize(new String(""));
73
- const expected = `String("")`;
73
+ const expect = `String("")`;
74
74
  assert({
75
75
  actual,
76
- expected,
76
+ expect,
77
77
  });
78
78
  }
79
79
 
80
80
  {
81
81
  // eslint-disable-next-line no-new-wrappers
82
82
  const actual = humanize(new String("dam"));
83
- const expected = `String("dam")`;
83
+ const expect = `String("dam")`;
84
84
  assert({
85
85
  actual,
86
- expected,
86
+ expect,
87
87
  });
88
88
  }
89
89
 
90
90
  {
91
91
  const actual = humanize("dam", { quote: "'" });
92
- const expected = `'dam'`;
93
- assert({ actual, expected });
92
+ const expect = `'dam'`;
93
+ assert({ actual, expect });
94
94
  }
95
95
 
96
96
  {
97
97
  const actual = humanize(`\`"'`);
98
- const expected = `"\`\\\"'"`;
99
- assert({ actual, expected });
98
+ const expect = `"\`\\\"'"`;
99
+ assert({ actual, expect });
100
100
  }
101
101
 
102
102
  {
103
103
  const actual = humanize(`""''`);
104
- const expected = `\`""''\``;
105
- assert({ actual, expected });
104
+ const expect = `\`""''\``;
105
+ assert({ actual, expect });
106
106
  }
@@ -3,18 +3,18 @@ import { humanize } from "@jsenv/humanize";
3
3
 
4
4
  {
5
5
  const actual = humanize(Symbol());
6
- const expected = "Symbol()";
7
- assert({ actual, expected });
6
+ const expect = "Symbol()";
7
+ assert({ actual, expect });
8
8
  }
9
9
 
10
10
  {
11
11
  const actual = humanize(Symbol("foo"));
12
- const expected = `Symbol("foo")`;
13
- assert({ actual, expected });
12
+ const expect = `Symbol("foo")`;
13
+ assert({ actual, expect });
14
14
  }
15
15
 
16
16
  {
17
17
  const actual = humanize(Symbol(42));
18
- const expected = `Symbol("42")`;
19
- assert({ actual, expected });
18
+ const expect = `Symbol("42")`;
19
+ assert({ actual, expect });
20
20
  }
@@ -2,5 +2,5 @@ import { assert } from "@jsenv/assert";
2
2
  import { humanize } from "@jsenv/humanize";
3
3
 
4
4
  const actual = humanize(undefined);
5
- const expected = "undefined";
6
- assert({ actual, expected });
5
+ const expect = "undefined";
6
+ assert({ actual, expect });
@@ -6,7 +6,7 @@ try {
6
6
  createLogger({ logLevel: "foo" });
7
7
  throw new Error("should throw");
8
8
  } catch (actual) {
9
- const expected = new Error(`unexpected logLevel.
9
+ const expect = new Error(`unexpected logLevel.
10
10
  --- logLevel ---
11
11
  foo
12
12
  --- allowed log levels ---
@@ -15,77 +15,77 @@ error
15
15
  warn
16
16
  info
17
17
  debug`);
18
- assert({ actual, expected });
18
+ assert({ actual, expect });
19
19
  }
20
20
 
21
21
  {
22
22
  const logger = createLogger();
23
23
  const actual = logger.levels;
24
- const expected = {
24
+ const expect = {
25
25
  debug: false,
26
26
  info: true,
27
27
  warn: true,
28
28
  error: true,
29
29
  };
30
- assert({ actual, expected });
30
+ assert({ actual, expect });
31
31
  }
32
32
 
33
33
  {
34
34
  const logger = createLogger({ logLevel: "off" });
35
35
  const actual = logger.levels;
36
- const expected = {
36
+ const expect = {
37
37
  debug: false,
38
38
  info: false,
39
39
  warn: false,
40
40
  error: false,
41
41
  };
42
- assert({ actual, expected });
42
+ assert({ actual, expect });
43
43
  }
44
44
 
45
45
  {
46
46
  const logger = createLogger({ logLevel: "debug" });
47
47
  const actual = logger.levels;
48
- const expected = {
48
+ const expect = {
49
49
  debug: true,
50
50
  info: true,
51
51
  warn: true,
52
52
  error: true,
53
53
  };
54
- assert({ actual, expected });
54
+ assert({ actual, expect });
55
55
  }
56
56
 
57
57
  {
58
58
  const logger = createLogger({ logLevel: "info" });
59
59
  const actual = logger.levels;
60
- const expected = {
60
+ const expect = {
61
61
  debug: false,
62
62
  info: true,
63
63
  warn: true,
64
64
  error: true,
65
65
  };
66
- assert({ actual, expected });
66
+ assert({ actual, expect });
67
67
  }
68
68
 
69
69
  {
70
70
  const logger = createLogger({ logLevel: "warn" });
71
71
  const actual = logger.levels;
72
- const expected = {
72
+ const expect = {
73
73
  debug: false,
74
74
  info: false,
75
75
  warn: true,
76
76
  error: true,
77
77
  };
78
- assert({ actual, expected });
78
+ assert({ actual, expect });
79
79
  }
80
80
 
81
81
  {
82
82
  const logger = createLogger({ logLevel: "error" });
83
83
  const actual = logger.levels;
84
- const expected = {
84
+ const expect = {
85
85
  debug: false,
86
86
  info: false,
87
87
  warn: false,
88
88
  error: true,
89
89
  };
90
- assert({ actual, expected });
90
+ assert({ actual, expect });
91
91
  }
@@ -12,22 +12,22 @@
12
12
 
13
13
  // {
14
14
  // const actual = getOutput()
15
- // const expected = `a loading\n`
16
- // assert({ actual, expected })
15
+ // const expect = `a loading\n`
16
+ // assert({ actual, expect })
17
17
  // }
18
18
  // getOutput = spyStreamOutput(process.stdout)
19
19
  // await new Promise((resolve) => setTimeout(resolve, 1500))
20
20
 
21
21
  // {
22
22
  // const actual = getOutput()
23
- // const expected = `b loading\n`
24
- // assert({ actual, expected })
23
+ // const expect = `b loading\n`
24
+ // assert({ actual, expect })
25
25
  // }
26
26
  // getOutput = spyStreamOutput(process.stdout)
27
27
  // await new Promise((resolve) => setTimeout(resolve, 1500))
28
28
 
29
29
  // {
30
30
  // const actual = getOutput()
31
- // const expected = `a loading\n`
32
- // assert({ actual, expected })
31
+ // const expect = `a loading\n`
32
+ // assert({ actual, expect })
33
33
  // }
@@ -2,9 +2,9 @@ import { assert } from "@jsenv/assert";
2
2
 
3
3
  import { distributePercentages } from "@jsenv/humanize";
4
4
 
5
- const test = (namedNumbers, expected) => {
5
+ const test = (namedNumbers, expect) => {
6
6
  const actual = distributePercentages(namedNumbers);
7
- assert({ actual, expected });
7
+ assert({ actual, expect });
8
8
  };
9
9
 
10
10
  test(
@@ -11,109 +11,109 @@ import {
11
11
  // rounds last decimal
12
12
  {
13
13
  const actual = setRoundedPrecision(0.54);
14
- const expected = 0.5;
15
- assert({ actual, expected });
14
+ const expect = 0.5;
15
+ assert({ actual, expect });
16
16
  }
17
17
  {
18
18
  const actual = setRoundedPrecision(0.55);
19
- const expected = 0.6;
20
- assert({ actual, expected });
19
+ const expect = 0.6;
20
+ assert({ actual, expect });
21
21
  }
22
22
  // floor last decimal
23
23
  {
24
24
  const actual = setFlooredPrecision(0.54);
25
- const expected = 0.5;
26
- assert({ actual, expected });
25
+ const expect = 0.5;
26
+ assert({ actual, expect });
27
27
  }
28
28
  {
29
29
  const actual = setFlooredPrecision(0.55);
30
- const expected = 0.5;
31
- assert({ actual, expected });
30
+ const expect = 0.5;
31
+ assert({ actual, expect });
32
32
  }
33
33
  {
34
34
  const actual = setFlooredPrecision(0.501);
35
- const expected = 0.5;
36
- assert({ actual, expected });
35
+ const expect = 0.5;
36
+ assert({ actual, expect });
37
37
  }
38
38
  // ceil last decimal
39
39
  {
40
40
  const actual = setCeiledPrecision(0.54);
41
- const expected = 0.6;
42
- assert({ actual, expected });
41
+ const expect = 0.6;
42
+ assert({ actual, expect });
43
43
  }
44
44
  {
45
45
  const actual = setCeiledPrecision(0.54);
46
- const expected = 0.6;
47
- assert({ actual, expected });
46
+ const expect = 0.6;
47
+ assert({ actual, expect });
48
48
  }
49
49
  {
50
50
  const actual = setCeiledPrecision(0.501);
51
- const expected = 0.6;
52
- assert({ actual, expected });
51
+ const expect = 0.6;
52
+ assert({ actual, expect });
53
53
  }
54
54
  // truncate last decimal
55
55
  {
56
56
  const actual = setPrecision(0.501);
57
- const expected = 0.5;
58
- assert({ actual, expected });
57
+ const expect = 0.5;
58
+ assert({ actual, expect });
59
59
  }
60
60
  {
61
61
  const actual = setPrecision(0.56);
62
- const expected = 0.5;
63
- assert({ actual, expected });
62
+ const expect = 0.5;
63
+ assert({ actual, expect });
64
64
  }
65
65
  // rounded tests
66
66
  {
67
67
  const actual = setRoundedPrecision(0.0101);
68
- const expected = 0.01;
69
- assert({ actual, expected });
68
+ const expect = 0.01;
69
+ assert({ actual, expect });
70
70
  }
71
71
  {
72
72
  const actual = setRoundedPrecision(0.012);
73
- const expected = 0.01;
74
- assert({ actual, expected });
73
+ const expect = 0.01;
74
+ assert({ actual, expect });
75
75
  }
76
76
  {
77
77
  const actual = setRoundedPrecision(0.016);
78
- const expected = 0.02;
79
- assert({ actual, expected });
78
+ const expect = 0.02;
79
+ assert({ actual, expect });
80
80
  }
81
81
  {
82
82
  const actual = setRoundedPrecision(0.016556, {
83
83
  decimals: 3,
84
84
  });
85
- const expected = 0.0166;
86
- assert({ actual, expected });
85
+ const expect = 0.0166;
86
+ assert({ actual, expect });
87
87
  }
88
88
  {
89
89
  const actual = setRoundedPrecision(0);
90
- const expected = 0;
91
- assert({ actual, expected });
90
+ const expect = 0;
91
+ assert({ actual, expect });
92
92
  }
93
93
  {
94
94
  const actual = setRoundedPrecision(-0.0015);
95
- const expected = -0.002;
96
- assert({ actual, expected });
95
+ const expect = -0.002;
96
+ assert({ actual, expect });
97
97
  }
98
98
 
99
99
  /* numbers above 1 */
100
100
  {
101
101
  const actual = setRoundedPrecision(37.04);
102
- const expected = 37;
103
- assert({ actual, expected });
102
+ const expect = 37;
103
+ assert({ actual, expect });
104
104
  }
105
105
  {
106
106
  const actual = setRoundedPrecision(37.05);
107
- const expected = 37.1;
108
- assert({ actual, expected });
107
+ const expect = 37.1;
108
+ assert({ actual, expect });
109
109
  }
110
110
  {
111
111
  const actual = setCeiledPrecision(37.01);
112
- const expected = 37.1;
113
- assert({ actual, expected });
112
+ const expect = 37.1;
113
+ assert({ actual, expect });
114
114
  }
115
115
  {
116
116
  const actual = setFlooredPrecision(37.01);
117
- const expected = 37;
118
- assert({ actual, expected });
117
+ const expect = 37;
118
+ assert({ actual, expect });
119
119
  }
@@ -2,9 +2,9 @@ import { assert } from "@jsenv/assert";
2
2
 
3
3
  import { humanizeDuration } from "@jsenv/humanize";
4
4
 
5
- const test = (durationInMs, expected) => {
5
+ const test = (durationInMs, expect) => {
6
6
  const actual = humanizeDuration(durationInMs);
7
- assert({ actual, expected });
7
+ assert({ actual, expect });
8
8
  };
9
9
 
10
10
  test(0.1, "0 second");
@@ -2,9 +2,9 @@ import { assert } from "@jsenv/assert";
2
2
 
3
3
  import { humanizeEllapsedTime } from "@jsenv/humanize";
4
4
 
5
- const test = (durationInMs, expected) => {
5
+ const test = (durationInMs, expect) => {
6
6
  const actual = humanizeEllapsedTime(durationInMs);
7
- assert({ actual, expected });
7
+ assert({ actual, expect });
8
8
  };
9
9
 
10
10
  test(2200, "2 seconds");
package/src/byte/byte.js CHANGED
@@ -4,7 +4,7 @@ export const humanizeFileSize = (numberOfBytes, { decimals, short } = {}) => {
4
4
  return inspectBytes(numberOfBytes, { decimals, short });
5
5
  };
6
6
 
7
- export const humanizeMemoryUsage = (metricValue, { decimals, short } = {}) => {
7
+ export const humanizeMemory = (metricValue, { decimals, short } = {}) => {
8
8
  return inspectBytes(metricValue, { decimals, fixedDecimals: true, short });
9
9
  };
10
10
 
@@ -65,7 +65,7 @@ export const humanize = (
65
65
 
66
66
  export const humanizeMethodSymbol = Symbol.for("inspect");
67
67
 
68
- export const humanizeValue = (value, options) => {
68
+ const humanizeValue = (value, options) => {
69
69
  const customHumanize = value && value[humanizeMethodSymbol];
70
70
  if (customHumanize) {
71
71
  return customHumanize(options);
@@ -0,0 +1,27 @@
1
+ // https://github.com/Marak/colors.js/blob/master/lib/styles.js
2
+ // https://stackoverflow.com/a/75985833/2634179
3
+ const RESET = "\x1b[0m";
4
+
5
+ export const ANSI = {
6
+ supported: true,
7
+
8
+ RED: "\x1b[31m",
9
+ GREEN: "\x1b[32m",
10
+ YELLOW: "\x1b[33m",
11
+ BLUE: "\x1b[34m",
12
+ MAGENTA: "\x1b[35m",
13
+ CYAN: "\x1b[36m",
14
+ GREY: "\x1b[90m",
15
+ color: (text, ANSI_COLOR) => {
16
+ return ANSI.supported && ANSI_COLOR ? `${ANSI_COLOR}${text}${RESET}` : text;
17
+ },
18
+
19
+ BOLD: "\x1b[1m",
20
+ UNDERLINE: "\x1b[4m",
21
+ STRIKE: "\x1b[9m",
22
+ effect: (text, ANSI_EFFECT) => {
23
+ return ANSI.supported && ANSI_EFFECT
24
+ ? `${ANSI_EFFECT}${text}${RESET}`
25
+ : text;
26
+ },
27
+ };
@@ -13,14 +13,19 @@ export const ANSI = {
13
13
  YELLOW: "\x1b[33m",
14
14
  BLUE: "\x1b[34m",
15
15
  MAGENTA: "\x1b[35m",
16
+ CYAN: "\x1b[36m",
16
17
  GREY: "\x1b[90m",
17
18
  color: (text, ANSI_COLOR) => {
18
- return ANSI.supported ? `${ANSI_COLOR}${text}${RESET}` : text;
19
+ return ANSI.supported && ANSI_COLOR ? `${ANSI_COLOR}${text}${RESET}` : text;
19
20
  },
20
21
 
21
22
  BOLD: "\x1b[1m",
23
+ UNDERLINE: "\x1b[4m",
24
+ STRIKE: "\x1b[9m",
22
25
  effect: (text, ANSI_EFFECT) => {
23
- return ANSI.supported ? `${ANSI_EFFECT}${text}${RESET}` : text;
26
+ return ANSI.supported && ANSI_EFFECT
27
+ ? `${ANSI_EFFECT}${text}${RESET}`
28
+ : text;
24
29
  },
25
30
  };
26
31
 
@@ -88,20 +88,22 @@ export const createDynamicLog = ({
88
88
  clearAttemptResult = undefined;
89
89
  };
90
90
 
91
- const clearDuringFunctionCall = (callback) => {
91
+ const clearDuringFunctionCall = (
92
+ callback,
93
+ ouputAfterCallback = lastOutput,
94
+ ) => {
92
95
  // 1. Erase the current log
93
- // 2. Call callback (expected to write something on stdout)
96
+ // 2. Call callback (expect to write something on stdout)
94
97
  // 3. Restore the current log
95
98
  // During step 2. we expect a "write from outside" so we uninstall
96
99
  // the stream spy during function call
97
- const currentOutput = lastOutput;
98
100
  update("");
99
101
 
100
102
  writing = true;
101
103
  callback();
102
104
  writing = false;
103
105
 
104
- update(currentOutput);
106
+ update(ouputAfterCallback);
105
107
  };
106
108
 
107
109
  const writeFromOutsideEffect = (value) => {
@@ -1,4 +1,4 @@
1
- import { ANSI } from "./ansi.js";
1
+ import { ANSI } from "./ansi_node.js";
2
2
 
3
3
  export const startSpinner = ({
4
4
  dynamicLog,
@@ -1,5 +1,5 @@
1
1
  import { humanizeDuration } from "../time/time.js";
2
- import { UNICODE } from "./unicode.js";
2
+ import { UNICODE } from "./unicode_node.js";
3
3
  import { createDynamicLog } from "./dynamic_log.js";
4
4
  import { startSpinner } from "./spinner.js";
5
5
 
@@ -0,0 +1,53 @@
1
+ // see also https://github.com/sindresorhus/figures
2
+
3
+ import { ANSI } from "./ansi_browser.js";
4
+
5
+ export const UNICODE = {
6
+ supported: true,
7
+
8
+ get COMMAND_RAW() {
9
+ return UNICODE.supported ? `❯` : `>`;
10
+ },
11
+ get OK_RAW() {
12
+ return UNICODE.supported ? `✔` : `√`;
13
+ },
14
+ get FAILURE_RAW() {
15
+ return UNICODE.supported ? `✖` : `×`;
16
+ },
17
+ get DEBUG_RAW() {
18
+ return UNICODE.supported ? `◆` : `♦`;
19
+ },
20
+ get INFO_RAW() {
21
+ return UNICODE.supported ? `ℹ` : `i`;
22
+ },
23
+ get WARNING_RAW() {
24
+ return UNICODE.supported ? `⚠` : `‼`;
25
+ },
26
+ get CIRCLE_CROSS_RAW() {
27
+ return UNICODE.supported ? `ⓧ` : `(×)`;
28
+ },
29
+ get COMMAND() {
30
+ return ANSI.color(UNICODE.COMMAND_RAW, ANSI.GREY); // ANSI_MAGENTA)
31
+ },
32
+ get OK() {
33
+ return ANSI.color(UNICODE.OK_RAW, ANSI.GREEN);
34
+ },
35
+ get FAILURE() {
36
+ return ANSI.color(UNICODE.FAILURE_RAW, ANSI.RED);
37
+ },
38
+ get DEBUG() {
39
+ return ANSI.color(UNICODE.DEBUG_RAW, ANSI.GREY);
40
+ },
41
+ get INFO() {
42
+ return ANSI.color(UNICODE.INFO_RAW, ANSI.BLUE);
43
+ },
44
+ get WARNING() {
45
+ return ANSI.color(UNICODE.WARNING_RAW, ANSI.YELLOW);
46
+ },
47
+ get CIRCLE_CROSS() {
48
+ return ANSI.color(UNICODE.CIRCLE_CROSS_RAW, ANSI.RED);
49
+ },
50
+ get ELLIPSIS() {
51
+ return UNICODE.supported ? `…` : `...`;
52
+ },
53
+ };
@@ -2,7 +2,7 @@
2
2
 
3
3
  import isUnicodeSupported from "is-unicode-supported";
4
4
 
5
- import { ANSI } from "./ansi.js";
5
+ import { ANSI } from "./ansi_node.js";
6
6
 
7
7
  export const UNICODE = {
8
8
  supported: isUnicodeSupported(),
@@ -49,4 +49,7 @@ export const UNICODE = {
49
49
  get CIRCLE_CROSS() {
50
50
  return ANSI.color(UNICODE.CIRCLE_CROSS_RAW, ANSI.RED);
51
51
  },
52
+ get ELLIPSIS() {
53
+ return UNICODE.supported ? `…` : `...`;
54
+ },
52
55
  };