MCPcopy Index your code
hub / github.com/Effect-TS/effect / arraySpliceIn

Function arraySpliceIn

packages/effect/src/internal/hashMap/array.ts:34–49  ·  view source on GitHub ↗
(mutate: boolean, at: number, v: A, arr: Array<A>)

Source from the content-addressed store, hash-verified

32
33/** @internal */
34export function arraySpliceIn<A>(mutate: boolean, at: number, v: A, arr: Array<A>) {
35 const len = arr.length
36 if (mutate) {
37 let i = len
38 while (i >= at) arr[i--] = arr[i]!
39 arr[at] = v
40 return arr
41 }
42 let i = 0,
43 g = 0
44 const out = new Array<A>(len + 1)
45 while (i < at) out[g++] = arr[i++]!
46 out[at] = v
47 while (i < len) out[++g] = arr[i++]!
48 return out
49}

Callers 1

modifyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected