Skip to content

Commit cf78d26

Browse files
committed
doc: clarify that path.isAbsolute on windows accepts / and \
Fixes: #6520
1 parent 5a7a6d9 commit cf78d26

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

doc/api/path.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,18 @@ path.isAbsolute('.') // false
261261
On Windows:
262262

263263
```js
264-
path.isAbsolute('//server') // true
265-
path.isAbsolute('C:/foo/..') // true
266-
path.isAbsolute('bar\\baz') // false
267-
path.isAbsolute('.') // false
264+
path.isAbsolute('//server') // true
265+
path.isAbsolute('\\\\server') // true
266+
path.isAbsolute('C:/foo/..') // true
267+
path.isAbsolute('C:\\foo\\..') // true
268+
path.isAbsolute('bar\\baz') // false
269+
path.isAbsolute('bar/baz') // false
270+
path.isAbsolute('.') // false
268271
```
269272

273+
*Note*: On Windows, the `path.isAbsolute()` method will accept both forward
274+
slash (`/`) and backwards slash (`\`) characters as path delimiters.
275+
270276
A [`TypeError`][] is thrown if `path` is not a string.
271277

272278
## path.join([path[, ...]])

0 commit comments

Comments
 (0)