MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / customGet

Function customGet

packages/components/nodes/sequentialagents/commonUtils.ts:138–171  ·  view source on GitHub ↗
(obj: any, path: string)

Source from the content-addressed store, hash-verified

136}
137
138export const customGet = (obj: any, path: string) => {
139 if (path.includes('[-1]')) {
140 const parts = path.split('.')
141 let result = obj
142
143 for (let part of parts) {
144 if (part.includes('[') && part.includes(']')) {
145 const [name, indexPart] = part.split('[')
146 const index = parseInt(indexPart.replace(']', ''))
147
148 result = result[name]
149 if (Array.isArray(result)) {
150 if (index < 0) {
151 result = result[result.length + index]
152 } else {
153 result = result[index]
154 }
155 } else {
156 return undefined
157 }
158 } else {
159 result = get(result, part)
160 }
161
162 if (result === undefined) {
163 return undefined
164 }
165 }
166
167 return result
168 } else {
169 return get(obj, path)
170 }
171}
172
173export const convertStructuredSchemaToZod = (schema: string | object): ICommonObject => {
174 try {

Callers 8

runConditionFunction · 0.90
getReturnOutputFunction · 0.90
getReturnOutputFunction · 0.90
runConditionFunction · 0.90
executeFuncMethod · 0.90
getReturnOutputFunction · 0.90
resolveFlowObjValueFunction · 0.90

Calls 1

getFunction · 0.85

Tested by

no test coverage detected