@@ -127,6 +127,17 @@ function normalizeString(path, allowAboveRoot, separator, isPathSeparator) {
127127 return res ;
128128}
129129
130+ /**
131+ * @param {string } sep
132+ * @param {{
133+ * dir?: string;
134+ * root?: string;
135+ * base?: string;
136+ * name?: string;
137+ * ext?: string;
138+ * }} pathObject
139+ * @returns {string }
140+ */
130141function _format ( sep , pathObject ) {
131142 validateObject ( pathObject , 'pathObject' ) ;
132143 const dir = pathObject . dir || pathObject . root ;
@@ -139,7 +150,11 @@ function _format(sep, pathObject) {
139150}
140151
141152const win32 = {
142- // path.resolve([from ...], to)
153+ /**
154+ * path.resolve([from ...], to)
155+ * @param {...string } args
156+ * @returns {string }
157+ */
143158 resolve ( ...args ) {
144159 let resolvedDevice = '' ;
145160 let resolvedTail = '' ;
@@ -282,6 +297,10 @@ const win32 = {
282297 `${ resolvedDevice } ${ resolvedTail } ` || '.' ;
283298 } ,
284299
300+ /**
301+ * @param {string } path
302+ * @returns {string }
303+ */
285304 normalize ( path ) {
286305 validateString ( path , 'path' ) ;
287306 const len = path . length ;
@@ -376,6 +395,10 @@ const win32 = {
376395 return isAbsolute ? `${ device } \\${ tail } ` : `${ device } ${ tail } ` ;
377396 } ,
378397
398+ /**
399+ * @param {string } path
400+ * @returns {boolean }
401+ */
379402 isAbsolute ( path ) {
380403 validateString ( path , 'path' ) ;
381404 const len = path . length ;
@@ -391,6 +414,10 @@ const win32 = {
391414 isPathSeparator ( StringPrototypeCharCodeAt ( path , 2 ) ) ) ;
392415 } ,
393416
417+ /**
418+ * @param {...string } args
419+ * @returns {string }
420+ */
394421 join ( ...args ) {
395422 if ( args . length === 0 )
396423 return '.' ;
@@ -457,10 +484,15 @@ const win32 = {
457484 return win32 . normalize ( joined ) ;
458485 } ,
459486
460- // It will solve the relative path from `from` to `to`, for instance:
461- // from = 'C:\\orandea\\test\\aaa'
462- // to = 'C:\\orandea\\impl\\bbb'
463- // The output of the function should be: '..\\..\\impl\\bbb'
487+ /**
488+ * It will solve the relative path from `from` to `to`, for instancee
489+ * from = 'C:\\orandea\\test\\aaa'
490+ * to = 'C:\\orandea\\impl\\bbb'
491+ * The output of the function should be: '..\\..\\impl\\bbb'
492+ * @param {string } from
493+ * @param {string } to
494+ * @returns {string }
495+ */
464496 relative ( from , to ) {
465497 validateString ( from , 'from' ) ;
466498 validateString ( to , 'to' ) ;
@@ -618,6 +650,10 @@ const win32 = {
618650 return path ;
619651 } ,
620652
653+ /**
654+ * @param {string } path
655+ * @returns {string }
656+ */
621657 dirname ( path ) {
622658 validateString ( path , 'path' ) ;
623659 const len = path . length ;
@@ -709,6 +745,11 @@ const win32 = {
709745 return StringPrototypeSlice ( path , 0 , end ) ;
710746 } ,
711747
748+ /**
749+ * @param {string } path
750+ * @param {string } [ext]
751+ * @returns {string }
752+ */
712753 basename ( path , ext ) {
713754 if ( ext !== undefined )
714755 validateString ( ext , 'ext' ) ;
@@ -792,6 +833,10 @@ const win32 = {
792833 return StringPrototypeSlice ( path , start , end ) ;
793834 } ,
794835
836+ /**
837+ * @param {string } path
838+ * @returns {string }
839+ */
795840 extname ( path ) {
796841 validateString ( path , 'path' ) ;
797842 let start = 0 ;
@@ -858,6 +903,16 @@ const win32 = {
858903
859904 format : FunctionPrototypeBind ( _format , null , '\\' ) ,
860905
906+ /**
907+ * @param {string } path
908+ * @returns {{
909+ * dir: string;
910+ * root: string;
911+ * base: string;
912+ * name: string;
913+ * ext: string;
914+ * }}
915+ */
861916 parse ( path ) {
862917 validateString ( path , 'path' ) ;
863918
@@ -1032,7 +1087,11 @@ const posixCwd = (() => {
10321087} ) ( ) ;
10331088
10341089const posix = {
1035- // path.resolve([from ...], to)
1090+ /**
1091+ * path.resolve([from ...], to)
1092+ * @param {...string } args
1093+ * @returns {string }
1094+ */
10361095 resolve ( ...args ) {
10371096 let resolvedPath = '' ;
10381097 let resolvedAbsolute = false ;
@@ -1065,6 +1124,10 @@ const posix = {
10651124 return resolvedPath . length > 0 ? resolvedPath : '.' ;
10661125 } ,
10671126
1127+ /**
1128+ * @param {string } path
1129+ * @returns {string }
1130+ */
10681131 normalize ( path ) {
10691132 validateString ( path , 'path' ) ;
10701133
@@ -1090,12 +1153,20 @@ const posix = {
10901153 return isAbsolute ? `/${ path } ` : path ;
10911154 } ,
10921155
1156+ /**
1157+ * @param {string } path
1158+ * @returns {boolean }
1159+ */
10931160 isAbsolute ( path ) {
10941161 validateString ( path , 'path' ) ;
10951162 return path . length > 0 &&
10961163 StringPrototypeCharCodeAt ( path , 0 ) === CHAR_FORWARD_SLASH ;
10971164 } ,
10981165
1166+ /**
1167+ * @param {...string } args
1168+ * @returns {string }
1169+ */
10991170 join ( ...args ) {
11001171 if ( args . length === 0 )
11011172 return '.' ;
@@ -1115,6 +1186,11 @@ const posix = {
11151186 return posix . normalize ( joined ) ;
11161187 } ,
11171188
1189+ /**
1190+ * @param {string } from
1191+ * @param {string } to
1192+ * @returns {string }
1193+ */
11181194 relative ( from , to ) {
11191195 validateString ( from , 'from' ) ;
11201196 validateString ( to , 'to' ) ;
@@ -1196,6 +1272,10 @@ const posix = {
11961272 return path ;
11971273 } ,
11981274
1275+ /**
1276+ * @param {string } path
1277+ * @returns {string }
1278+ */
11991279 dirname ( path ) {
12001280 validateString ( path , 'path' ) ;
12011281 if ( path . length === 0 )
@@ -1222,6 +1302,11 @@ const posix = {
12221302 return StringPrototypeSlice ( path , 0 , end ) ;
12231303 } ,
12241304
1305+ /**
1306+ * @param {string } path
1307+ * @param {string } [ext]
1308+ * @returns {string }
1309+ */
12251310 basename ( path , ext ) {
12261311 if ( ext !== undefined )
12271312 validateString ( ext , 'ext' ) ;
@@ -1297,6 +1382,10 @@ const posix = {
12971382 return StringPrototypeSlice ( path , start , end ) ;
12981383 } ,
12991384
1385+ /**
1386+ * @param {string } path
1387+ * @returns {string }
1388+ */
13001389 extname ( path ) {
13011390 validateString ( path , 'path' ) ;
13021391 let startDot = - 1 ;
@@ -1351,6 +1440,16 @@ const posix = {
13511440
13521441 format : FunctionPrototypeBind ( _format , null , '/' ) ,
13531442
1443+ /**
1444+ * @param {string } path
1445+ * @returns {{
1446+ * dir: string;
1447+ * root: string;
1448+ * base: string;
1449+ * name: string;
1450+ * ext: string;
1451+ * }}
1452+ */
13541453 parse ( path ) {
13551454 validateString ( path , 'path' ) ;
13561455
0 commit comments