Skip to content

Commit

Permalink
chore: replace deprecated String.prototype.substr() (#894)
Browse files Browse the repository at this point in the history
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
  • Loading branch information
CommanderRoot committed Mar 23, 2022
1 parent 06aa205 commit 326cdf3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Expand Up @@ -186,7 +186,7 @@ function ncc (
// allow using match from regex in result
// e.g. caniuse-lite(/.*) -> caniuse-lite$1
result = result.replace(/(\$\d)/g, (match) => {
const index = parseInt(match.substr(1), 10)
const index = parseInt(match.slice(1), 10)
return matches[index] || match
})
}
Expand Down Expand Up @@ -654,14 +654,14 @@ function getFlatFiles(mfsData, output, getAssetMeta, tsconfig, curBase = "") {
if (item[""] === true) getFlatFiles(item, output, getAssetMeta, tsconfig, curPath);
// file
else if (!curPath.endsWith("/")) {
const meta = getAssetMeta(curPath.substr(1)) || {};
const meta = getAssetMeta(curPath.slice(1)) || {};
if(curPath.endsWith(".d.ts")) {
const outDir = tsconfig.compilerOptions.outDir ? pathResolve(tsconfig.compilerOptions.outDir) : pathResolve('dist');
curPath = curPath
.replace(outDir, "")
.replace(process.cwd(), "")
}
output[curPath.substr(1)] = {
output[curPath.slice(1)] = {
source: mfsData[path],
permissions: meta.permissions
};
Expand Down

0 comments on commit 326cdf3

Please sign in to comment.