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

Class PathExpr

An expression whose value represents a (relative or absolute) file system path.

Each path expression is associated with one or more root folders, each of which has a priority. Root folders with numerically smaller properties are preferred, meaning that a path expression is interpreted relative to the root folder with the smallest priority for which the path can be resolved.

For example, path expressions inside a module may have that module’s folder as their highest-priority root, with default library paths as additional roots of lower priority.

Import path

import javascript

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

getAdditionalSearchRoot

INTERNAL. Use getSearchRoot instead.

getBaseName

Gets the base name of the folder or file this path refers to.

getComponent

Gets the ith component of this path.

getEnclosingModule

Gets the module containing this path expression, if any.

getExtension

Gets the extension of the folder or file this path refers to, that is, the suffix of the base name starting at the last dot character, if there is one.

getNumComponent

Gets the number of components of this path.

getSearchRoot

Gets the root folder of priority priority associated with this path expression.

getStem

Gets the stem, that is, base name without extension, of the folder or file this path refers to.

getValue

Gets the (unresolved) path represented by this expression.

resolve

Gets the file or folder that this path refers to.

resolve

Gets the file or folder that this path refers to when resolved relative to the root folder of the given priority.

resolveUpTo

Gets the file or folder that the first n components of this path refer to.

resolveUpTo

Gets the file or folder that the first n components of this path refer to when resolved relative to the root folder of the given priority.

Inherited predicates

getAPrimaryQlClass

Gets the primary QL class for the Locatable.

from Locatable
getEndLine

Gets the line on which this element ends.

from Locatable
getFile

Gets the file this program element comes from.

from Locatable
getLocation

Gets this element’s location.

from Locatable
getNumLines

Gets the number of lines covered by this element.

from Locatable
getPrimaryQlClasses

Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.

from Locatable
getStartLine

Gets the line on which this element starts.

from Locatable
toString

Gets a textual representation of this element.

from Locatable