MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / extractVariables

Function extractVariables

packages/agentflow/src/core/utils/variableUtils.ts:13–26  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

11 * // => ['question', 'node1.data.instance']
12 */
13export function extractVariables(text: string): string[] {
14 const matches: string[] = []
15 let match: RegExpExecArray | null
16 // Reset lastIndex for safety (global regex)
17 VARIABLE_REGEX.lastIndex = 0
18 while ((match = VARIABLE_REGEX.exec(text)) !== null) {
19 const inside = match[1].trim()
20 // Skip JSON-like content (e.g. {{"key": "value"}})
21 if (!inside.includes(':')) {
22 matches.push(inside)
23 }
24 }
25 return matches
26}
27
28/**
29 * Recursively walk edges backward from `nodeId` to collect **all** ancestor nodes

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected