MCPcopy Index your code
hub / github.com/marijnh/Eloquent-JavaScript / detectSourceType

Function detectSourceType

src/client/sandbox.mjs:404–406  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

402}
403
404function detectSourceType(code) {
405 return /(^|\n)\s*(im|ex)port\b/.test(code) ? "module" : "script"
406}
407
408function randomID() {
409 return Math.floor(Math.random() * 0xffffffff).toString(16)

Callers 1

preprocessFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected