CodeQL library for JavaScript/TypeScript
codeql/javascript-all 0.9.1 (changelog, source)

Predicate findNodeModulesFolder

Holds if nodeModules is a folder of the form <prefix>/node_modules, where <prefix> is a (not necessarily proper) prefix of f and does not end in /node_modules, and distance is the number of path elements of f that are missing from <prefix>.

This predicate implements the NODE_MODULES_PATHS procedure from the specification of require.resolve.

For example, if f is /a/node_modules/b, we get the following results:


Import path

import javascript
predicate findNodeModulesFolder(Folder f, Folder nodeModules, int distance)