# utils/splicearray

module

<a id="functions">

## Functions

<a id="function-spliceArray">

### `spliceArray( targetArray, insertArray, index ) → void`

Splices one array into another. To be used instead of `Array.prototype.splice` for better performance and because the latter may throw "Maximum call stack size exceeded" error when passing huge number of items to insert.

```typescript
spliceArray( [ 1, 2 ], [ 3, 4 ], 0 );	// [ 3, 4, 1, 2 ]
spliceArray( [ 1, 2 ], [ 3, 4 ], 1 );	// [ 1, 3, 4, 2 ]
spliceArray( [ 1, 2 ], [ 3, 4 ], 2 );	// [ 1, 2, 3, 4 ]
spliceArray( [ 1, 2 ], [],	   0 );	// [ 1, 2 ]
```

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/splicearray.ts#L28)

#### Type parameters

* `T`

#### Parameters

* `targetArray: Array<T>`

  Array to be spliced.

* `insertArray: Array<T>`

  Array of elements to be inserted to target.

* `index: number`

  Index at which nodes should be inserted.

#### Returns

* `void`

  New spliced array.

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
