Skip to content

Commit 722a573

Browse files
knightburtonyichoi
authored andcommitted
Fix the different name cases in getScriptIdByName (#25)
IoT.js-Debug-DCO-1.0-Signed-off-by: Imre Kiss [email protected]
1 parent ddb85c5 commit 722a573

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/JerryProtocolHandler.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -592,13 +592,8 @@ export class JerryDebugProtocolHandler {
592592
}
593593

594594
public getScriptIdByName(name: string): number {
595-
// skip the first (dummy) source
596-
for (let i = 1; i < this.sources.length; i++) {
597-
const source: ParsedSource = this.sources[i];
598-
if (name === source.name) {
599-
return i;
600-
}
601-
}
595+
const index = this.sources.findIndex(s => s.name && s.name.endsWith(name));
596+
if (index > 0) return index;
602597
throw new Error('no such source');
603598
}
604599

0 commit comments

Comments
 (0)