Skip to content

Commit

Permalink
Chore: Simplify search code
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenwade committed May 20, 2021
1 parent cba69f2 commit 00ac183
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/source-code/token-store/utils.js
Expand Up @@ -30,8 +30,7 @@ function getStartLocation(token) {
* @returns {number} The found index or `tokens.length`.
*/
exports.search = function search(tokens, location) {
const val = getStartLocation({ range: [location] });
const index = tokens.findIndex(el => val <= getStartLocation(el));
const index = tokens.findIndex(el => location <= getStartLocation(el));

return index === -1 ? tokens.length : index;
};
Expand Down

0 comments on commit 00ac183

Please sign in to comment.