Function
main
({ messageType, format, validateStream, n })
Source from the content-addressed store, hash-verified
| 26 | }); |
| 27 | |
| 28 | function main({ messageType, format, validateStream, n }) { |
| 29 | let str; |
| 30 | switch (messageType) { |
| 31 | case 'string': |
| 32 | str = 'hello world'; |
| 33 | break; |
| 34 | case 'number': |
| 35 | str = 10; |
| 36 | break; |
| 37 | case 'boolean': |
| 38 | str = true; |
| 39 | break; |
| 40 | case 'invalid': |
| 41 | str = undefined; |
| 42 | break; |
| 43 | } |
| 44 | |
| 45 | bench.start(); |
| 46 | for (let i = 0; i < n; i++) { |
| 47 | const fmt = format === '#rotating' ? hexColors[i % kHexColorCount] : format; |
| 48 | let colored = ''; |
| 49 | try { |
| 50 | colored = styleText(fmt, str, { validateStream }); |
| 51 | assert.ok(colored); // Attempt to avoid dead-code elimination |
| 52 | } catch { |
| 53 | // eslint-disable no-empty |
| 54 | } |
| 55 | } |
| 56 | bench.end(n); |
| 57 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…