diff options
author | Tobias Nießen <tniessen@tnie.de> | 2017-04-03 13:02:12 +0200 |
---|---|---|
committer | Benjamin Gruenbaum <benji@tipranks.com> | 2017-04-15 00:44:12 +0300 |
commit | 7fd2923f1fcce9a782d450f01ad414589030c596 (patch) | |
tree | da4e577b09e95ed2fdf944f7cac67f51507f577a | |
parent | 8a6d44b10b8be681848dac44b9eb540e1c01dcc5 (diff) | |
download | android-node-v8-7fd2923f1fcce9a782d450f01ad414589030c596.tar.gz android-node-v8-7fd2923f1fcce9a782d450f01ad414589030c596.tar.bz2 android-node-v8-7fd2923f1fcce9a782d450f01ad414589030c596.zip |
doc: path functions ignore trailing slashes
Add notes about path.parse(), path.basename() and path.dirname()
ignoring trailing slashes.
PR-URL: https://github.com/nodejs/node/pull/12181
Fixes: https://github.com/nodejs/node/issues/6229
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
-rw-r--r-- | doc/api/path.md | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/doc/api/path.md b/doc/api/path.md index afb44d2de0..a6f1701261 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -68,7 +68,8 @@ changes: * Returns: {string} The `path.basename()` methods returns the last portion of a `path`, similar to -the Unix `basename` command. +the Unix `basename` command. Trailing directory separators are ignored, see +[`path.sep`][]. For example: @@ -128,7 +129,8 @@ changes: * Returns: {string} The `path.dirname()` method returns the directory name of a `path`, similar to -the Unix `dirname` command. +the Unix `dirname` command. Trailing directory separators are ignored, see +[`path.sep`][]. For example: @@ -347,7 +349,8 @@ added: v0.11.15 * Returns: {Object} The `path.parse()` method returns an object whose properties represent -significant elements of the `path`. +significant elements of the `path`. Trailing directory separators are ignored, +see [`path.sep`][]. The returned object will have the following properties: @@ -519,6 +522,10 @@ On Windows: // Returns: ['foo', 'bar', 'baz'] ``` +*Note*: On Windows, both the forward slash (`/`) and backward slash (`\`) are +accepted as path segment separators; however, the `path` methods only add +backward slashes (`\`). + ## path.win32 <!-- YAML added: v0.11.15 @@ -529,11 +536,8 @@ added: v0.11.15 The `path.win32` property provides access to Windows-specific implementations of the `path` methods. -*Note*: On Windows, both the forward slash (`/`) and backward slash (`\`) -characters are accepted as path delimiters; however, only the backward slash -(`\`) will be used in return values. - [`path.posix`]: #path_path_posix +[`path.sep`]: #path_path_sep [`path.win32`]: #path_path_win32 [`path.parse()`]: #path_path_parse_path [`TypeError`]: errors.html#errors_class_typeerror |