From 97ba9f83ed987e96f810eb9913c5fcd8bae47808 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Tue, 27 Apr 2021 18:57:50 -0500 Subject: [PATCH] fix: use indexof inside onRemoveFile --- lib/paths-cache.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/paths-cache.js b/lib/paths-cache.js index bfd41db..54292c1 100644 --- a/lib/paths-cache.js +++ b/lib/paths-cache.js @@ -224,13 +224,8 @@ export default class PathsCache extends EventEmitter { const filePaths = this._filePathsByProjectDirectory.get(projectDirectory.path) // delete the removed file - for (let iFile = 0; iFile < filePaths.length; iFile++) { - const file = filePaths[iFile] - if (file === removedFile) { - delete filePaths[iFile] - break - } - } + const fileIndex = filePaths.indexOf(removedFile) + delete filePaths[fileIndex] this._filePathsByProjectDirectory.set(projectDirectory.path, filePaths) }