| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent edc3033 commit 6877139
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2520,7 +2520,8 @@ function formatExtraProperties(ctx, value, recurseTimes, key, typedArray) { | |||
| 2520 | 2520 | ctx.indentationLvl -= 2; | |
| 2521 | 2521 | ||
| 2522 | 2522 | // These entries are mainly getters. Should they be formatted like getters? | |
| 2523 | - return ctx.stylize(`[${key}]: ${str}`, 'string'); | ||
| 2523 | + const name = ctx.stylize(`[${key}]`, 'string'); | ||
| 2524 | + return `${name}: ${str}`; | ||
| 2524 | 2525 | } | |
| 2525 | 2526 | ||
| 2526 | 2527 | function formatProperty(ctx, value, recurseTimes, key, type, desc, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2391,6 +2391,20 @@ assert.strictEqual( | |||
| 2391 | 2391 | inspect.styles.string = stringStyle; | |
| 2392 | 2392 | } | |
| 2393 | 2393 | ||
| 2394 | + // Special (extra) properties follow normal coloring: | ||
| 2395 | + // only the name is colored, ":" and space are unstyled. | ||
| 2396 | + { | ||
| 2397 | + const [open, close] = inspect.colors[inspect.styles.string]; | ||
| 2398 | + const keyPattern = (k) => new RegExp( | ||
| 2399 | + `\\u001b\\[${open}m\\[${k}\\]\\u001b\\[${close}m: ` | ||
| 2400 | + ); | ||
| 2401 | + const colored = util.inspect(new Uint8Array(0), { showHidden: true, colors: true }); | ||
| 2402 | + assert.match(colored, keyPattern('BYTES_PER_ELEMENT')); | ||
| 2403 | + assert.match(colored, keyPattern('length')); | ||
| 2404 | + assert.match(colored, keyPattern('byteLength')); | ||
| 2405 | + assert.match(colored, keyPattern('byteOffset')); | ||
| 2406 | + } | ||
| 2407 | + | ||
| 2394 | 2408 | assert.strictEqual( | |
| 2395 | 2409 | inspect([1, 3, 2], { sorted: true }), | |
| 2396 | 2410 | inspect([1, 3, 2]) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments