MCPcopy Index your code
hub / github.com/react-hook-form/react-hook-form / insert

Function insert

src/utils/insert.ts:9–19  ·  view source on GitHub ↗
(
  data: T[],
  index: number,
  value?: T | T[],
)

Source from the content-addressed store, hash-verified

7 value: T | T[],
8): T[];
9export default function insert<T>(
10 data: T[],
11 index: number,
12 value?: T | T[],
13): (T | undefined)[] {
14 return [
15 ...data.slice(0, index),
16 ...convertToArrayPayload(value),
17 ...data.slice(index),
18 ];
19}

Callers 15

AppFunction · 0.50
ComponentFunction · 0.50
AppFunction · 0.50
handleDuplicateFunction · 0.50
insert.test.tsFile · 0.50
ComponentFunction · 0.50
FieldArrayFunction · 0.50
AppFunction · 0.50
ComponentFunction · 0.50
AppFunction · 0.50
WatchUseFieldArrayFunction · 0.50
NestedArrayFunction · 0.50

Calls

no outgoing calls

Tested by 9

AppFunction · 0.40
ComponentFunction · 0.40
AppFunction · 0.40
handleDuplicateFunction · 0.40
ComponentFunction · 0.40
FieldArrayFunction · 0.40
AppFunction · 0.40
ComponentFunction · 0.40
AppFunction · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…