Skip to content

Commit 551f0d8

Browse files
committed
refactor: simplify bounds check with .some()
1 parent e1ec087 commit 551f0d8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/strategies/prune-tool.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ export function createPruneTool(
7272
const toolIdList: string[] = buildToolIdList(messages)
7373

7474
// Validate that all numeric IDs are within bounds
75-
const invalidIds = numericToolIds.filter(id => id < 0 || id >= toolIdList.length)
76-
if (invalidIds.length > 0) {
75+
if (numericToolIds.some(id => id < 0 || id >= toolIdList.length)) {
7776
return "Invalid IDs provided. Only use numeric IDs from the <prunable-tools> list."
7877
}
7978

0 commit comments

Comments
 (0)