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

replaced substr with substring #12066

Merged
merged 6 commits into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/jest-config/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const replaceRootDirInPath = (

return path.resolve(
rootDir,
path.normalize('./' + filePath.substr('<rootDir>'.length)),
path.normalize('./' + filePath.substring('<rootDir>'.length)),
);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-haste-map/src/lib/fast_path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as path from 'path';
// rootDir and filename must be absolute paths (resolved)
export function relative(rootDir: string, filename: string): string {
return filename.indexOf(rootDir + path.sep) === 0
? filename.substr(rootDir.length + 1)
? filename.substring(rootDir.length + 1)
: path.relative(rootDir, filename);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-haste-map/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export async function worker(data: WorkerMessage): Promise<WorkerMetadata> {
} catch (err: any) {
throw new Error(`Cannot parse ${filePath} as JSON: ${err.message}`);
}
} else if (!blacklist.has(filePath.substr(filePath.lastIndexOf('.')))) {
} else if (!blacklist.has(filePath.substring(filePath.lastIndexOf('.')))) {
// Process a random file that is returned as a MODULE.
if (hasteImpl) {
id = hasteImpl.getHasteName(filePath);
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-snapshot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function stripAddedIndentation(inlineSnapshot: string) {
return inlineSnapshot;
}

lines[i] = lines[i].substr(indentation.length);
lines[i] = lines[i].substring(indentation.length);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/jest-transform/src/ScriptTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,9 @@ function readCodeCacheFile(cachePath: Config.Path): string | null {
if (content == null) {
return null;
}
const code = content.substr(33);
const code = content.substring(33);
const checksum = createHash('md5').update(code).digest('hex');
if (checksum === content.substr(0, 32)) {
if (checksum === content.substring(0, 32)) {
SimenB marked this conversation as resolved.
Show resolved Hide resolved
return code;
}
return null;
Expand Down