-
Notifications
You must be signed in to change notification settings - Fork 478
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
Remove dead branches #344
Conversation
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); |
There was a problem hiding this comment.
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.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
Some dead branches observed while working on #342.