From 00ac18335bcf449406208fa9b7228f3ae72f0ccd Mon Sep 17 00:00:00 2001 From: Stephen Wade Date: Wed, 19 May 2021 23:10:19 -0400 Subject: [PATCH] Chore: Simplify search code --- lib/source-code/token-store/utils.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/source-code/token-store/utils.js b/lib/source-code/token-store/utils.js index b65c7347ab09..50e8a255cedf 100644 --- a/lib/source-code/token-store/utils.js +++ b/lib/source-code/token-store/utils.js @@ -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; };