MCPcopy Create free account
hub / github.com/observablehq/framework / hasImportDeclaration

Function hasImportDeclaration

src/javascript/imports.ts:45–55  ·  view source on GitHub ↗
(body: Node)

Source from the content-addressed store, hash-verified

43
44/** Returns true if the body includes an import declaration. */
45export function hasImportDeclaration(body: Node): boolean {
46 let has = false;
47
48 simple(body, {
49 ImportDeclaration() {
50 has = true;
51 }
52 });
53
54 return has;
55}
56
57/**
58 * Finds all imports (both static and dynamic, local and global) with

Callers 2

imports-test.tsFile · 0.85
transpileJavaScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected