-
Notifications
You must be signed in to change notification settings - Fork 490
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,28 +50,18 @@ function matchItems(array1, array2, index1, index2, context) { | |
// no way to match objects was provided, try match by position | ||
return context.matchByPosition && index1 === index2; | ||
} | ||
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); | ||
} | ||
if (typeof hash1 === 'undefined') { | ||
return false; | ||
} | ||
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); | ||
Comment on lines
-67
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
if (typeof hash2 === 'undefined') { | ||
return false; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,11 +81,7 @@ const get = function (array1, array2, match, context) { | |
match || defaultMatch, | ||
innerContext, | ||
); | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}; | ||
|
||
export default { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,11 +182,7 @@ class BaseFormatter { | |
if (arrayKeys && key === '_t') { | ||
continue; | ||
} | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const isLast = index === length - 1; | ||
fn(key, leftKey, moveDestinations[leftKey], isLast); | ||
} | ||
|
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.