CodeQL library for JavaScript/TypeScript
codeql/javascript-all 2.0.3-dev (changelog, source)
Search

Predicate AccessPath::getAnAssignmentTo

Gets a node that is assigned to the given global access path.

Only gets the immediate right-hand side of an assignment or property or a global declaration, not nodes that transitively flow there.

For example, the class nodes below are all assignments to foo.bar:

foo.bar = class {};
foo = { bar: class {} };
(function(f) {
  f.bar = class {}
 })(foo = foo || {});

Import path

import javascript
Node getAnAssignmentTo(string path)