MCPcopy Create free account
hub / github.com/stenciljs/core / javaScriptSyntaxHighlight

Function javaScriptSyntaxHighlight

src/sys/node/logger/terminal-logger.ts:437–450  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

435 * @returns the text with highlighted JS/TS
436 */
437 const javaScriptSyntaxHighlight = (text: string): string => {
438 if (text.trim().startsWith('//')) {
439 return dim(text);
440 }
441
442 const words = text.split(' ').map((word: string) => {
443 if (JS_KEYWORDS.indexOf(word) > -1) {
444 return cyan(word);
445 }
446 return word;
447 });
448
449 return words.join(' ');
450 };
451
452 /**
453 * Highlights CSS syntax, taking in text and selectively highlighting keywords from the language

Callers 1

printDiagnosticFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected