Skip to content

Commit

Permalink
Change order of inversionAttempts check for tslint
Browse files Browse the repository at this point in the history
  • Loading branch information
LakeGH committed Nov 14, 2019
1 parent 0dfc578 commit 4f3fef8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ function jsQR(data: Uint8ClampedArray, width: number, height: number, providedOp
(options as any)[opt] = (providedOptions as any)[opt] || (options as any)[opt];
});

const shouldInvert = options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst" || options.inversionAttempts === "onlyInvert";
const tryInvertedFirst = options.inversionAttempts === "onlyInvert" || options.inversionAttempts === "invertFirst";
const shouldInvert = options.inversionAttempts === "attemptBoth" || tryInvertedFirst;

const {binarized, inverted} = binarize(data, width, height, shouldInvert);
let result = scan(tryInvertedFirst ? inverted : binarized);
if (!result && (options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst")) {
Expand Down

0 comments on commit 4f3fef8

Please sign in to comment.