Skip to content

Commit a1a8d48

Browse files
[feat] Replace removeFromArray with lodash pull (#4906)
Co-authored-by: Claude <[email protected]>
1 parent d22d62b commit a1a8d48

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/lib/litegraph/src/subgraph/SubgraphOutput.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { pull } from 'lodash'
2+
13
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
24
import { LLink } from '@/lib/litegraph/src/LLink'
35
import type { RerouteId } from '@/lib/litegraph/src/Reroute'
@@ -9,7 +11,6 @@ import type {
911
} from '@/lib/litegraph/src/interfaces'
1012
import { LiteGraph } from '@/lib/litegraph/src/litegraph'
1113
import { NodeSlotType } from '@/lib/litegraph/src/types/globalEnums'
12-
import { removeFromArray } from '@/lib/litegraph/src/utils/collections'
1314

1415
import type { SubgraphInput } from './SubgraphInput'
1516
import type { SubgraphOutputNode } from './SubgraphOutputNode'
@@ -59,7 +60,7 @@ export class SubgraphOutput extends SubgraphSlot {
5960
existingLink.disconnect(subgraph, 'input')
6061
const resolved = existingLink.resolve(subgraph)
6162
const links = resolved.output?.links
62-
if (links) removeFromArray(links, existingLink.id)
63+
if (links) pull(links, existingLink.id)
6364
}
6465

6566
const link = new LLink(

src/lib/litegraph/src/utils/collections.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,3 @@ export function findFreeSlotOfType<T extends { type: ISlotType }>(
112112
}
113113
return wildSlot ?? occupiedSlot ?? occupiedWildSlot
114114
}
115-
116-
export function removeFromArray<T>(array: T[], value: T): boolean {
117-
const index = array.indexOf(value)
118-
const found = index !== -1
119-
120-
if (found) array.splice(index, 1)
121-
return found
122-
}

0 commit comments

Comments
 (0)