Skip to content

Commit bfe349d

Browse files
committed
JS: More doc
1 parent 486937f commit bfe349d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

javascript/ql/lib/semmle/javascript/Paths.qll

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ deprecated private class ConsPath extends Path, TConsPath {
9696
private string pathRegex() { result = "(.*)(?:/|^)(([^/]*?)(\\.([^.]*))?)" }
9797

9898
/**
99-
* A `string` with some additional member predicates for extracting parts of a path string.
99+
* A `string` with some additional member predicates for extracting parts of the file path.
100100
*/
101101
class FilePath extends string {
102102
bindingset[this]
@@ -147,8 +147,14 @@ class FilePath extends string {
147147
predicate isDotRelativePath() { this.regexpMatch("\\.\\.?(?:[/\\\\].*)?") }
148148

149149
/**
150-
* Gets the NPM package name from the beginning of the given import path, e.g.
151-
* gets `foo` from `foo/bar`, and `@example/foo` from `@example/foo/bar`.
150+
* Gets the NPM package name from the beginning of the given import path.
151+
*
152+
* Has no result for paths starting with a `.` or `/`
153+
*
154+
* For example:
155+
* - `foo/bar` maps to `foo`
156+
* - `@example/foo/bar` maps to `@example/foo`
157+
* - `./foo` maps to nothing.
152158
*/
153159
bindingset[this]
154160
string getPackagePrefix() {

0 commit comments

Comments
 (0)