Module

utils/splicearray

@ckeditor/ckeditor5-utils/src/splicearray

module

Filtering

Functions

  • 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.

    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>
    insertArray : Array<T>
    index : number

    Returns

    void

    New spliced array.