utils/splicearray
module
Functions
-
spliceArray( targetArray, insertArray, index ) → voidmodule:utils/splicearray~spliceArraySplices one array into another. To be used instead of
Array.prototype.splicefor 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 ]Copy codeType parameters
T
Parameters
targetArray : Array<T>Array to be spliced.
insertArray : Array<T>Array of elements to be inserted to target.
index : numberIndex at which nodes should be inserted.
Returns
voidNew spliced array.