MCPcopy Create free account
hub / github.com/microsoft/Webwright / normalizeCodeLanguage

Function normalizeCodeLanguage

assets/compare_trajectory/app.js:375–390  ·  view source on GitHub ↗
(language)

Source from the content-addressed store, hash-verified

373}
374
375function normalizeCodeLanguage(language) {
376 const value = String(language || '').trim().toLowerCase();
377 if (!value) {
378 return '';
379 }
380 if (value === 'sh' || value === 'shell' || value === 'zsh') {
381 return 'bash';
382 }
383 if (value === 'py') {
384 return 'python';
385 }
386 if (value === 'patch') {
387 return 'diff';
388 }
389 return value;
390}
391
392function looksLikeShell(text) {
393 return /(^|\n)\s*(\$ |(?:cd|ls|pwd|cat|rg|sed|find|git|npm|pnpm|yarn|uv|python|python3|bash|sh|chmod|cp|mv|rm)\b)/m.test(String(text || ''));

Callers 3

inferCodeLanguageFunction · 0.85
buildRichTextSectionsFunction · 0.85
codeClassFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected