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

Function isParamReference

src/javascript/params.ts:34–49  ·  view source on GitHub ↗
(node: MemberExpression)

Source from the content-addressed store, hash-verified

32 });
33
34 function isParamReference(node: MemberExpression): node is ParamReference {
35 if (
36 node.object.type !== "MemberExpression" ||
37 node.object.object.type !== "Identifier" ||
38 node.object.object.name !== "observable" ||
39 node.object.property.type !== "Identifier" ||
40 node.object.property.name !== "params" ||
41 !references.includes(node.object.object)
42 ) {
43 return false;
44 }
45 if (node.property.type !== "Identifier" && node.property.type !== "Literal") {
46 throw syntaxError("invalid param reference", node, input);
47 }
48 return true;
49 }
50
51 return matches;
52}

Callers 1

MemberExpressionFunction · 0.85

Calls 1

syntaxErrorFunction · 0.85

Tested by

no test coverage detected