Line data Source code
1 : import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
2 :
3 : /**
4 : * Checks if a node is an output node.
5 : * Output nodes are nodes that have the output_node flag set in their nodeData.
6 : *
7 : * @param node - The node to check
8 : * @returns True if the node is an output node, false otherwise
9 : */
10 2355 : export const isOutputNode = (node: LGraphNode) =>
11 : node.constructor.nodeData?.output_node
12 :
13 : /**
14 : * Filters nodes to find only output nodes.
15 : * Output nodes are nodes that have the output_node flag set in their nodeData.
16 : *
17 : * @param nodes - Array of nodes to filter
18 : * @returns Array of output nodes only
19 : */
20 2355 : export const filterOutputNodes = (nodes: LGraphNode[]): LGraphNode[] =>
21 : nodes.filter(isOutputNode)
|