MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / isJavaScriptBlock

Function isJavaScriptBlock

src/extraction/razor-script.ts:239–243  ·  view source on GitHub ↗
(attrs: string)

Source from the content-addressed store, hash-verified

237
238/** Whether a `<script>` element's attributes leave it JavaScript: no `type`, or a JavaScript one. */
239export function isJavaScriptBlock(attrs: string): boolean {
240 const type = /\btype\s*=\s*["']([^"']*)["']/i.exec(attrs)?.[1]?.trim().toLowerCase();
241 if (type === undefined || type === '') return true;
242 return /^(?:module|(?:text|application)\/(?:javascript|ecmascript|typescript|babel|jsx)|text\/(?:x-)?(?:babel|jsx))$/.test(type);
243}

Callers 2

processScriptBlocksMethod · 0.90

Calls 1

execMethod · 0.65

Tested by

no test coverage detected