@@ -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
10388Examples:
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.
135102path .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