MCPcopy
hub / github.com/final-form/final-form / setIn

Function setIn

src/structure/setIn.ts:162–183  ·  view source on GitHub ↗
(
  state: object,
  key: string,
  value: any,
  destroyArrays: boolean = false
)

Source from the content-addressed store, hash-verified

160};
161
162const setIn: SetIn = (
163 state: object,
164 key: string,
165 value: any,
166 destroyArrays: boolean = false
167): object => {
168 if (state === undefined || state === null) {
169 throw new Error(`Cannot call setIn() with ${String(state)} state`);
170 }
171 if (key === undefined || key === null) {
172 throw new Error(`Cannot call setIn() with ${String(key)} key`);
173 }
174 // Recursive function needs to accept and return State, but public API should
175 // only deal with Objects
176 return setInRecursor(
177 state,
178 0,
179 toPath(key),
180 value,
181 destroyArrays
182 ) as object;
183};
184
185export default setIn;

Callers 5

changeValueFunction · 0.85
renameFieldFunction · 0.85
processErrorsFunction · 0.85
createFormFunction · 0.85
setIn.test.tsFile · 0.85

Calls 2

setInRecursorFunction · 0.85
toPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…