Refactor to improve iterations
- Use function abstractions (such as map, reduce, filter etc.) over for-of loops to gain benefits of having less side effects and easier readability. - Enable `downLevelIterations` for writing modern code with lazy evaluation. - Refactor for of loops to named abstractions to clearly express their intentions without needing to analyse the loop itself. - Add missing cases for changes that had no tests.
This commit is contained in:
@@ -58,12 +58,9 @@ function deepEqual(
|
||||
if (!scrambledEqual(expectedParameterNames, actualParameterNames)) {
|
||||
return false;
|
||||
}
|
||||
for (const parameterName of expectedParameterNames) {
|
||||
return expectedParameterNames.every((parameterName) => {
|
||||
const expectedValue = expected.getArgument(parameterName).argumentValue;
|
||||
const actualValue = actual.getArgument(parameterName).argumentValue;
|
||||
if (expectedValue !== actualValue) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return expectedValue === actualValue;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user