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

Function setValueAtPath

packages/components/src/utils.ts:1981–1995  ·  view source on GitHub ↗
(obj: any, path: (string | number)[], value: any)

Source from the content-addressed store, hash-verified

1979
1980 // Helper function to set a value at a nested path
1981 const setValueAtPath = (obj: any, path: (string | number)[], value: any): void => {
1982 let current = obj
1983 for (let i = 0; i < path.length - 1; i++) {
1984 const key = path[i]
1985 if (current && typeof current === 'object' && key in current) {
1986 current = current[key]
1987 } else {
1988 return // Path doesn't exist
1989 }
1990 }
1991 if (current !== undefined && current !== null) {
1992 const finalKey = path[path.length - 1]
1993 current[finalKey] = value
1994 }
1995 }
1996
1997 // Helper function to get a value at a nested path
1998 const getValueAtPath = (obj: any, path: (string | number)[]): any => {

Callers 1

parseWithTypeConversionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected