+10
-1
lines changedFilter options
+10
-1
lines changed Original file line number Diff line number Diff line change
@@ -2408,6 +2408,9 @@ added:
2408
2408
- v21.7.0
2409
2409
- v20.12.0
2410
2410
changes:
2411
+
- version: REPLACEME
2412
+
pr-url: https://github.com/nodejs/node/pull/58437
2413
+
description: Added the `'none'` format as a non-op format.
2411
2414
- version:
2412
2415
- v23.5.0
2413
2416
- v22.13.0
@@ -2483,6 +2486,8 @@ console.log(
2483
2486
);
2484
2487
```
2485
2488
2489
+
The special format value `none` applies no additional styling to the text.
2490
+
2486
2491
The full list of formats can be found in [modifiers][].
2487
2492
2488
2493
## Class: `util.TextDecoder`
Original file line number Diff line number Diff line change
@@ -100,10 +100,11 @@ function lazyAbortController() {
100
100
let internalDeepEqual;
101
101
102
102
/**
103
-
* @param {string} code
103
+
* @param {string} [code]
104
104
* @returns {string}
105
105
*/
106
106
function escapeStyleCode(code) {
107
+
if (code === undefined) return '';
107
108
return `\u001b[${code}m`;
108
109
}
109
110
@@ -139,6 +140,7 @@ function styleText(format, text, { validateStream = true, stream = process.stdou
139
140
let left = '';
140
141
let right = '';
141
142
for (const key of formatArray) {
143
+
if (key === 'none') continue;
142
144
const formatCodes = inspect.colors[key];
143
145
// If the format is not a valid style, throw an error
144
146
if (formatCodes == null) {
Original file line number Diff line number Diff line change
@@ -75,6 +75,8 @@ assert.strictEqual(
75
75
styled,
76
76
);
77
77
78
+
assert.strictEqual(util.styleText('none', 'test'), 'test');
79
+
78
80
const fd = common.getTTYfd();
79
81
if (fd !== -1) {
80
82
const writeStream = new WriteStream(fd);
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4