utils/splicearray
module
Functions
-
spliceArray( targetArray, insertArray, index ) → void
module:utils/splicearray~spliceArray
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.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 ]
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.