From b13ff339fad2fa4e48630eba8a6a608022c995f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Mon, 12 Jun 2023 17:02:34 +0200 Subject: [PATCH] fix: remove side effect from `some` callback --- .../workbench/api/common/extHostTerminalService.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/api/common/extHostTerminalService.ts b/src/vs/workbench/api/common/extHostTerminalService.ts index 07f2364ffed..04b61d8b808 100644 --- a/src/vs/workbench/api/common/extHostTerminalService.ts +++ b/src/vs/workbench/api/common/extHostTerminalService.ts @@ -816,15 +816,12 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I } private _getTerminalObjectIndexById(array: T[], id: ExtHostTerminalIdentifier): number | null { - let index: number | null = null; - array.some((item, i) => { - const thisId = item._id; - if (thisId === id) { - index = i; - return true; - } - return false; + const index = array.findIndex(item => { + return item._id === id; }); + if (index === -1) { + return null; + } return index; }