Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace deprecated String.prototype.substr() #894

Merged
merged 1 commit into from Mar 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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