@@ -743,12 +743,12 @@ const win32 = { |
743 | 743 |
|
744 | 744 | /** |
745 | 745 | * @param {string} path |
746 | | - * @param {string} [ext] |
| 746 | + * @param {string} [suffix] |
747 | 747 | * @returns {string} |
748 | 748 | */ |
749 | | - basename(path, ext) { |
750 | | - if (ext !== undefined) |
751 | | - validateString(ext, 'ext'); |
| 749 | + basename(path, suffix) { |
| 750 | + if (suffix !== undefined) |
| 751 | + validateString(suffix, 'ext'); |
752 | 752 | validateString(path, 'path'); |
753 | 753 | let start = 0; |
754 | 754 | let end = -1; |
@@ -763,10 +763,10 @@ const win32 = { |
763 | 763 | start = 2; |
764 | 764 | } |
765 | 765 |
|
766 | | - if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { |
767 | | - if (ext === path) |
| 766 | + if (suffix !== undefined && suffix.length > 0 && suffix.length <= path.length) { |
| 767 | + if (suffix === path) |
768 | 768 | return ''; |
769 | | - let extIdx = ext.length - 1; |
| 769 | + let extIdx = suffix.length - 1; |
770 | 770 | let firstNonSlashEnd = -1; |
771 | 771 | for (let i = path.length - 1; i >= start; --i) { |
772 | 772 | const code = StringPrototypeCharCodeAt(path, i); |
@@ -786,7 +786,7 @@ const win32 = { |
786 | 786 | } |
787 | 787 | if (extIdx >= 0) { |
788 | 788 | // Try to match the explicit extension |
789 | | - if (code === StringPrototypeCharCodeAt(ext, extIdx)) { |
| 789 | + if (code === StringPrototypeCharCodeAt(suffix, extIdx)) { |
790 | 790 | if (--extIdx === -1) { |
791 | 791 | // We matched the extension, so mark this as the end of our path |
792 | 792 | // component |
@@ -1300,22 +1300,22 @@ const posix = { |
1300 | 1300 |
|
1301 | 1301 | /** |
1302 | 1302 | * @param {string} path |
1303 | | - * @param {string} [ext] |
| 1303 | + * @param {string} [suffix] |
1304 | 1304 | * @returns {string} |
1305 | 1305 | */ |
1306 | | - basename(path, ext) { |
1307 | | - if (ext !== undefined) |
1308 | | - validateString(ext, 'ext'); |
| 1306 | + basename(path, suffix) { |
| 1307 | + if (suffix !== undefined) |
| 1308 | + validateString(suffix, 'ext'); |
1309 | 1309 | validateString(path, 'path'); |
1310 | 1310 |
|
1311 | 1311 | let start = 0; |
1312 | 1312 | let end = -1; |
1313 | 1313 | let matchedSlash = true; |
1314 | 1314 |
|
1315 | | - if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { |
1316 | | - if (ext === path) |
| 1315 | + if (suffix !== undefined && suffix.length > 0 && suffix.length <= path.length) { |
| 1316 | + if (suffix === path) |
1317 | 1317 | return ''; |
1318 | | - let extIdx = ext.length - 1; |
| 1318 | + let extIdx = suffix.length - 1; |
1319 | 1319 | let firstNonSlashEnd = -1; |
1320 | 1320 | for (let i = path.length - 1; i >= 0; --i) { |
1321 | 1321 | const code = StringPrototypeCharCodeAt(path, i); |
@@ -1335,7 +1335,7 @@ const posix = { |
1335 | 1335 | } |
1336 | 1336 | if (extIdx >= 0) { |
1337 | 1337 | // Try to match the explicit extension |
1338 | | - if (code === StringPrototypeCharCodeAt(ext, extIdx)) { |
| 1338 | + if (code === StringPrototypeCharCodeAt(suffix, extIdx)) { |
1339 | 1339 | if (--extIdx === -1) { |
1340 | 1340 | // We matched the extension, so mark this as the end of our path |
1341 | 1341 | // component |
|