Skip to content

Remove dead branches #344

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

Merged
merged 3 commits into from
Sep 3, 2023
Merged

Remove dead branches #344

merged 3 commits into from
Sep 3, 2023

Conversation

Methuselah96
Copy link
Collaborator

Some dead branches observed while working on #342.

Comment on lines -53 to +56
let hash1;
let hash2;
if (typeof index1 === 'number') {
context.hashCache1 = context.hashCache1 || [];
hash1 = context.hashCache1[index1];
if (typeof hash1 === 'undefined') {
context.hashCache1[index1] = hash1 = objectHash(value1, index1);
}
} else {
hash1 = objectHash(value1);
context.hashCache1 = context.hashCache1 || [];
let hash1 = context.hashCache1[index1];
if (typeof hash1 === 'undefined') {
context.hashCache1[index1] = hash1 = objectHash(value1, index1);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index1 will always be a number based on the usages of this method (i.e., matchItems). matchItems is not exported so there is no concern of it being used differently by users.

Comment on lines -67 to +64
if (typeof index2 === 'number') {
context.hashCache2 = context.hashCache2 || [];
hash2 = context.hashCache2[index2];
if (typeof hash2 === 'undefined') {
context.hashCache2[index2] = hash2 = objectHash(value2, index2);
}
} else {
hash2 = objectHash(value2);
context.hashCache2 = context.hashCache2 || [];
let hash2 = context.hashCache2[index2];
if (typeof hash2 === 'undefined') {
context.hashCache2[index2] = hash2 = objectHash(value2, index2);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index2 will always be a number based on the usages of this method (i.e., matchItems). matchItems is not exported so there is no concern of it being used differently by users.

const result = backtrack(matrix, array1, array2, innerContext);
if (typeof array1 === 'string' && typeof array2 === 'string') {
result.sequence = result.sequence.join('');
}
return result;
return backtrack(matrix, array1, array2, innerContext);
Copy link
Collaborator Author

@Methuselah96 Methuselah96 Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

array1 and array2 are never strings based on the usages of lcs.get. lcs.get is not exported through the package entrypoint so there is no concern of it being used differently by users.

const leftKey = arrayKeys
? typeof key === 'number'
? key
: parseInt(trimUnderscore(key), 10)
: key;
const leftKey = arrayKeys ? parseInt(trimUnderscore(key), 10) : key;
Copy link
Collaborator Author

@Methuselah96 Methuselah96 Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key cannot be a number because all of the values pushed to the keys array are strings. keys and key are both local variables so there is no concern of it being used differently by users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants