Skip to content

Commit

Permalink
fix: use nullish coalescing to check user configuration prior to defa…
Browse files Browse the repository at this point in the history
…ult `misMatchThreshold` and `requireSameDimensions` values (#1557)
  • Loading branch information
dgrebb committed Mar 5, 2024
1 parent a0a9507 commit 3e8c96a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/util/engineTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @returns {number} The mismatch threshold value.
*/
function getMisMatchThreshHold (scenario, config) {
return scenario?.misMatchThreshold || config?.misMatchThreshold || config?.defaultMisMatchThreshold || 0.1;
return scenario?.misMatchThreshold ?? config?.misMatchThreshold ?? config?.defaultMisMatchThreshold ?? 0.1;
}

function ensureFileSuffix (filename, suffix) {
Expand Down Expand Up @@ -43,7 +43,7 @@ function genHash (str) {
* @returns {boolean} True if the same dimensions are required, otherwise false.
*/
function getRequireSameDimensions (scenario, config) {
return scenario?.requireSameDimensions || config?.requireSameDimensions || config?.defaultMisMatchThreshold || true;
return scenario?.requireSameDimensions ?? config?.requireSameDimensions ?? config?.defaultMisMatchThreshold ?? true;
}

function getSelectorName (selector) {
Expand Down

0 comments on commit 3e8c96a

Please sign in to comment.