Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVse Mozhet Byt <vsemozhetbyt@gmail.com>2017-04-10 02:45:33 +0300
committerVse Mozhet Byt <vsemozhetbyt@gmail.com>2017-04-12 03:21:47 +0300
commita91242569ab9e1ee80832ce982e07975c3e047a6 (patch)
treed6f1eb6a06aa4d83f47e852b97e4cb3b18670ef6 /doc/api/path.md
parent42be835e054b46bb3b3cfb0683ca51cb86b5f1f7 (diff)
doc: modernize and fix code examples in path.md
Unify spaces, quotes, and semicolons. Update output examples. PR-URL: https://github.com/nodejs/node/pull/12296 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/path.md')
-rw-r--r--doc/api/path.md32
1 files changed, 14 insertions, 18 deletions
diff --git a/doc/api/path.md b/doc/api/path.md
index 0039e2c3ef1..afb44d2de0f 100644
--- a/doc/api/path.md
+++ b/doc/api/path.md
@@ -236,8 +236,8 @@ On Windows:
```js
path.format({
- dir : "C:\\path\\dir",
- base : "file.txt"
+ dir: 'C:\\path\\dir',
+ base: 'file.txt'
});
// Returns: 'C:\\path\\dir\\file.txt'
```
@@ -299,7 +299,7 @@ path.join('/foo', 'bar', 'baz/asdf', 'quux', '..')
// Returns: '/foo/bar/baz/asdf'
path.join('foo', {}, 'bar')
-// throws TypeError: Arguments to path.join must be strings
+// throws 'TypeError: Path must be a string. Received {}'
```
A [`TypeError`][] is thrown if any of the path segments is not a string.
@@ -332,7 +332,7 @@ path.normalize('/foo/bar//baz/asdf/quux/..')
On Windows:
```js
-path.normalize('C:\\temp\\\\foo\\bar\\..\\');
+path.normalize('C:\\temp\\\\foo\\bar\\..\\')
// Returns: 'C:\\temp\\foo\\'
```
@@ -362,13 +362,11 @@ For example on POSIX:
```js
path.parse('/home/user/dir/file.txt')
// Returns:
-// {
-// root : "/",
-// dir : "/home/user/dir",
-// base : "file.txt",
-// ext : ".txt",
-// name : "file"
-// }
+// { root: '/',
+// dir: '/home/user/dir',
+// base: 'file.txt',
+// ext: '.txt',
+// name: 'file' }
```
```text
@@ -386,13 +384,11 @@ On Windows:
```js
path.parse('C:\\path\\dir\\file.txt')
// Returns:
-// {
-// root : "C:\\",
-// dir : "C:\\path\\dir",
-// base : "file.txt",
-// ext : ".txt",
-// name : "file"
-// }
+// { root: 'C:\\',
+// dir: 'C:\\path\\dir',
+// base: 'file.txt',
+// ext: '.txt',
+// name: 'file' }
```
```text