Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: clarify path.isAbsolute doesn’t resolve paths
  • Loading branch information
ericfortis committed Feb 15, 2025
commit 6399f9e61a9257d8165dcfe65d0346b449c23e7c
13 changes: 8 additions & 5 deletions doc/api/path.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,17 +317,20 @@ added: v0.11.2
* `path` {string}
* Returns: {boolean}

The `path.isAbsolute()` method determines if `path` is an absolute path.
The `path.isAbsolute()` method determines if the literal (non-resolved) `path`
is an absolute path. Therefore, it’s likely that you want to run it through
`path.normalize()` before using it in `path.join()` or `path.isAbsolute()`.
Comment thread
aduh95 marked this conversation as resolved.
Outdated

If the given `path` is a zero-length string, `false` will be returned.

For example, on POSIX:

```js
path.isAbsolute('/foo/bar'); // true
path.isAbsolute('/baz/..'); // true
path.isAbsolute('qux/'); // false
path.isAbsolute('.'); // false
path.isAbsolute('/foo/bar'); // true
path.isAbsolute('/baz/..'); // true
path.isAbsolute('/baz/../..'); // true (doesn’t resolve)
Comment thread
aduh95 marked this conversation as resolved.
Outdated
path.isAbsolute('qux/'); // false
path.isAbsolute('.'); // false
```

On Windows:
Expand Down