Skip to content

Commit

Permalink
Fix: Unicorn fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jul 29, 2021
1 parent 99cef61 commit 4a6bf87
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/source-code/token-store/index.js
Expand Up @@ -80,13 +80,13 @@ function createCursorWithSkip(factory, tokens, comments, indexMap, startLoc, end
let filter = null;

if (typeof opts === "number") {
// eslint-disable-next-line unicorn/prefer-math-trunc -- Side effects
// eslint-disable-next-line unicorn/prefer-math-trunc -- Could be NaN
skip = opts | 0;
} else if (typeof opts === "function") {
filter = opts;
} else if (opts) {
includeComments = !!opts.includeComments;
// eslint-disable-next-line unicorn/prefer-math-trunc -- Side effects
// eslint-disable-next-line unicorn/prefer-math-trunc -- Could be NaN
skip = opts.skip | 0;
filter = opts.filter || null;
}
Expand Down Expand Up @@ -118,14 +118,14 @@ function createCursorWithCount(factory, tokens, comments, indexMap, startLoc, en
let filter = null;

if (typeof opts === "number") {
// eslint-disable-next-line unicorn/prefer-math-trunc -- Side effects
// eslint-disable-next-line unicorn/prefer-math-trunc -- Could be NaN
count = opts | 0;
countExists = true;
} else if (typeof opts === "function") {
filter = opts;
} else if (opts) {
includeComments = !!opts.includeComments;
// eslint-disable-next-line unicorn/prefer-math-trunc -- Side effects
// eslint-disable-next-line unicorn/prefer-math-trunc -- Could be NaN
count = opts.count | 0;
countExists = typeof opts.count === "number";
filter = opts.filter || null;
Expand Down Expand Up @@ -168,7 +168,8 @@ function createCursorWithPadding(tokens, comments, indexMap, startLoc, endLoc, b
return new ForwardTokenCursor(tokens, comments, indexMap, startLoc, endLoc);
}
if (typeof beforeCount === "number" || typeof beforeCount === "undefined") {
return new PaddedTokenCursor(tokens, comments, indexMap, startLoc, endLoc, Math.trunc(beforeCount), Math.trunc(afterCount));
// eslint-disable-next-line unicorn/prefer-math-trunc -- Could be NaN
return new PaddedTokenCursor(tokens, comments, indexMap, startLoc, endLoc, beforeCount | 0, afterCount | 0);
}
return createCursorWithCount(cursors.forward, tokens, comments, indexMap, startLoc, endLoc, beforeCount);
}
Expand Down

0 comments on commit 4a6bf87

Please sign in to comment.