Skip to content

Commit

Permalink
refactor: replace deprecated String.prototype.substr() (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderRoot committed Jun 1, 2022
1 parent bd10e13 commit f61bc5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,15 +607,15 @@ class TerserPlugin {
const querySplit = filename.indexOf("?");

if (querySplit >= 0) {
query = filename.substr(querySplit);
filename = filename.substr(0, querySplit);
query = filename.slice(querySplit);
filename = filename.slice(0, querySplit);
}

const lastSlashIndex = filename.lastIndexOf("/");
const basename =
lastSlashIndex === -1
? filename
: filename.substr(lastSlashIndex + 1);
: filename.slice(lastSlashIndex + 1);
const data = { filename, basename, query };

output.commentsFilename = compilation.getPath(
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/readAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default (asset, compiler, stats) => {
const queryStringIdx = targetFile.indexOf("?");

if (queryStringIdx >= 0) {
targetFile = targetFile.substr(0, queryStringIdx);
targetFile = targetFile.slice(0, queryStringIdx);
}

try {
Expand Down

0 comments on commit f61bc5d

Please sign in to comment.