Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3695690

Browse filesBrowse files
author
Myles Borins
committed
doc: revert backported commits
This reverts changes found in daf3ef6 0943001 that incorrectly updated the docs for `path.format` PR-URL: #6530 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 433fb9a commit 3695690
Copy full SHA for 3695690

File tree

Expand file treeCollapse file tree

1 file changed

+1
-46
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-46
lines changed
Open diff view settings
Collapse file

‎doc/api/path.markdown‎

Copy file name to clipboardExpand all lines: doc/api/path.markdown
+1-46Lines changed: 1 addition & 46 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,7 @@ path.extname('.index')
8383

8484
## path.format(pathObject)
8585

86-
Returns a path string from an object. This is the opposite of [`path.parse`][].
87-
88-
If `pathObject` has `dir` and `base` properties, the returned string will
89-
be a concatenation of the `dir` property, the platform-dependent path separator,
90-
and the `base` property.
91-
92-
If the `dir` property is not supplied, the `root` property will be used as the
93-
`dir` property. However, it will be assumed that the `root` property already
94-
ends with the platform-dependent path separator. In this case, the returned
95-
string will be the concatenation of the `root` property and the `base` property.
96-
97-
If both the `dir` and the `root` properties are not supplied, then the returned
98-
string will be the contents of the `base` property.
99-
100-
If the `base` property is not supplied, a concatenation of the `name` property
101-
and the `ext` property will be used as the `base` property.
86+
Returns a path string from an object, the opposite of [`path.parse`][].
10287

10388
Examples:
10489

@@ -113,42 +98,12 @@ path.format({
11398
});
11499
// returns '/home/user/dir/file.txt'
115100

116-
// `root` will be used if `dir` is not specified.
117-
// `name` + `ext` will be used if `base` is not specified.
118-
// If only `root` is provided or `dir` is equal to `root` then the
119-
// platform separator will not be included.
120-
path.format({
121-
root: '/',
122-
base: 'file.txt'
123-
});
124-
// returns '/file.txt'
125-
126-
path.format({
127-
dir: '/',
128-
root: '/',
129-
name: 'file',
130-
ext: '.txt'
131-
});
132-
// returns '/file.txt'
133-
134101
// `base` will be returned if `dir` or `root` are not provided.
135102
path.format({
136103
base: 'file.txt'
137104
});
138105
// returns 'file.txt'
139106
```
140-
An example on Windows:
141-
142-
```js
143-
path.format({
144-
root : "C:\\",
145-
dir : "C:\\path\\dir",
146-
base : "file.txt",
147-
ext : ".txt",
148-
name : "file"
149-
})
150-
// returns 'C:\\path\\dir\\file.txt'
151-
```
152107

153108
## path.isAbsolute(path)
154109

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.