Skip to content
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

refactor: simplify options handling #174

Conversation

eventualbuddha
Copy link
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

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