Skip to content

refactor: simplify options handling#174

Closed
eventualbuddha wants to merge 1 commit intocozmo:masterfrom
votingworks:refactor/simplify-options-handling
Closed

refactor: simplify options handling#174
eventualbuddha wants to merge 1 commit intocozmo:masterfrom
votingworks:refactor/simplify-options-handling

Conversation

@eventualbuddha
Copy link
Copy Markdown
Contributor

As there's only one option, it seems simpler to just pull that one out into a local variable.

@eventualbuddha eventualbuddha force-pushed the refactor/simplify-options-handling branch from bc4e529 to 27265b2 Compare May 2, 2020 21:34
@eventualbuddha eventualbuddha force-pushed the refactor/simplify-options-handling branch from 27265b2 to 17085b5 Compare May 2, 2020 21:35
const {binarized, inverted} = binarize(data, width, height, shouldInvert);
let result = scan(tryInvertedFirst ? inverted : binarized);
if (!result && (options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst")) {
if (!result && (inversionAttempts === "attemptBoth" || inversionAttempts === "invertFirst")) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think this can be simplified to:

-if (!result && (inversionAttempts === "attemptBoth" || inversionAttempts === "invertFirst")) {
+if (!result && shouldInvert) {

@eventualbuddha eventualbuddha deleted the refactor/simplify-options-handling branch March 17, 2021 04:42
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