X-Git-Url: https://git.josue.xyz/?p=dotfiles%2F.git;a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Feslint%2Flib%2Fsource-code%2Ftoken-store%2Futils.js;h=a2bd77de71a32ecf8166e76e704ed6ee04a05865;hp=21e1d6ff7c3b6d1504fdc7f03798738d56099acf;hb=3be0a9efc698a9570a44456009afc6014812625a;hpb=d2f432cc757f42f0318fdddcab8c00b240d47088 diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/source-code/token-store/utils.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/source-code/token-store/utils.js index 21e1d6ff..a2bd77de 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/source-code/token-store/utils.js +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/source-code/token-store/utils.js @@ -4,12 +4,6 @@ */ "use strict"; -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const lodash = require("lodash"); - //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -29,18 +23,16 @@ function getStartLocation(token) { //------------------------------------------------------------------------------ /** - * Binary-searches the index of the first token which is after the given location. + * Finds the index of the first token which is after the given location. * If it was not found, this returns `tokens.length`. * @param {(Token|Comment)[]} tokens It searches the token in this list. * @param {number} location The location to search. * @returns {number} The found index or `tokens.length`. */ exports.search = function search(tokens, location) { - return lodash.sortedIndexBy( - tokens, - { range: [location] }, - getStartLocation - ); + const index = tokens.findIndex(el => location <= getStartLocation(el)); + + return index === -1 ? tokens.length : index; }; /**