Skip to content

Commit

Permalink
chore: refactor default vs named exports/imports
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Apr 5, 2024
1 parent 00aacb1 commit d8177ed
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/source-code/token-store/backward-token-cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//------------------------------------------------------------------------------

const Cursor = require("./cursor");
const utils = require("./utils");
const { getLastIndex, getFirstIndex } = require("./utils");

//------------------------------------------------------------------------------
// Exports
Expand All @@ -31,8 +31,8 @@ module.exports = class BackwardTokenCursor extends Cursor {
constructor(tokens, comments, indexMap, startLoc, endLoc) {
super();
this.tokens = tokens;
this.index = utils.getLastIndex(tokens, indexMap, endLoc);
this.indexEnd = utils.getFirstIndex(tokens, indexMap, startLoc);
this.index = getLastIndex(tokens, indexMap, endLoc);
this.indexEnd = getFirstIndex(tokens, indexMap, startLoc);
}

/** @inheritdoc */
Expand Down
6 changes: 4 additions & 2 deletions lib/source-code/token-store/cursors.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,7 @@ class CursorFactory {
// Exports
//------------------------------------------------------------------------------

exports.forward = new CursorFactory(ForwardTokenCursor, ForwardTokenCommentCursor);
exports.backward = new CursorFactory(BackwardTokenCursor, BackwardTokenCommentCursor);
module.exports = {
forward: new CursorFactory(ForwardTokenCursor, ForwardTokenCommentCursor),
backward: new CursorFactory(BackwardTokenCursor, BackwardTokenCommentCursor),
};
4 changes: 2 additions & 2 deletions lib/source-code/token-store/forward-token-comment-cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//------------------------------------------------------------------------------

const Cursor = require("./cursor");
const utils = require("./utils");
const { search } = require("./utils");

//------------------------------------------------------------------------------
// Exports
Expand All @@ -33,7 +33,7 @@ module.exports = class ForwardTokenCommentCursor extends Cursor {
this.tokens = tokens;
this.comments = comments;
this.tokenIndex = utils.getFirstIndex(tokens, indexMap, startLoc);
this.commentIndex = utils.search(comments, startLoc);
this.commentIndex = search(comments, startLoc);
this.border = endLoc;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/source-code/token-store/forward-token-cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//------------------------------------------------------------------------------

const Cursor = require("./cursor");
const utils = require("./utils");
const { getFirstIndex, getLastIndex } = require("./utils");

//------------------------------------------------------------------------------
// Exports
Expand All @@ -31,8 +31,8 @@ module.exports = class ForwardTokenCursor extends Cursor {
constructor(tokens, comments, indexMap, startLoc, endLoc) {
super();
this.tokens = tokens;
this.index = utils.getFirstIndex(tokens, indexMap, startLoc);
this.indexEnd = utils.getLastIndex(tokens, indexMap, endLoc);
this.index = getFirstIndex(tokens, indexMap, startLoc);
this.indexEnd = getLastIndex(tokens, indexMap, endLoc);
}

/** @inheritdoc */
Expand Down

0 comments on commit d8177ed

Please sign in to comment.