splice(index, count, ...extraArgs) {
        let idx = index;
        // expect a number or return undefined
        if (idx !== (idx | 0)) {
            return void 0;
        }
        const size = this.size();
        if (idx < 0) {
            idx += size;
        }
        if (idx > size) {
            return void 0;
        }
        if (extraArgs.length > 0) {
            let k;
            let temp;
            let removed;
            let argumentsLength = extraArgs.length;
            const len = this.list.length;
            let argumentsIndex = 0;
            if (!size || idx < size / 2) {
                temp = new Array(idx);
                for (k = 0; k < idx; k++) {
                    temp[k] = this.list[(this.head + k) & this.capacityMask];
                }
                if (count === 0) {
                    removed = [];
                    if (idx > 0) {
                        this.head = (this.head + idx + len) & this.capacityMask;
                    }
                }
                else {
                    removed = this.remove(idx, count);
                    this.head = (this.head + idx + len) & this.capacityMask;
                }
                while (argumentsLength > argumentsIndex) {
                    this.unshift(extraArgs[--argumentsLength]);
                }
                for (k = idx; k > 0; k--) {
                    this.unshift(temp[k - 1]);
                }
            }
            else {
                temp = new Array(size - (idx + count));
                const tempLength = temp.length;
                for (k = 0; k < tempLength; k++) {
                    temp[k] = this.list[(this.head + idx + count + k) & this.capacityMask];
                }
                if (count === 0) {
                    removed = [];
                    if (idx !== size) {
                        this.tail = (this.head + idx + len) & this.capacityMask;
                    }
                }
                else {
                    removed = this.remove(idx, count);
                    this.tail = (this.tail - tempLength + len) & this.capacityMask;
                }
                while (argumentsIndex < argumentsLength) {
                    this.push(extraArgs[argumentsIndex++]);
                }
                for (k = 0; k < tempLength; k++) {
                    this.push(temp[k]);
                }
            }
            return removed;
        }
        else {
            return this.remove(idx, count);
        }
    }
/**
     * Native splice implementation.
     * Remove number of items from the specified index from the list and/or add new elements.
     * Returns array of removed items or empty array if count == 0.
     * Returns undefined if the list is empty.
     *
     * @param index
     * @param count
     * @param {...*} [elements]
     * @returns {array}
     */
Native splice implementation.
Remove number of items from the specified index from the list and/or add new elements.
Returns array of removed items or empty array if count == 0.
Returns undefined if the list is empty.


Native splice implementation . Remove number of items from the specified index from the list and / or add new elements . Returns array of removed items or empty array if count == 0 . Returns undefined if the list is empty .
splice(index, count, ...extraArgs) {
        let idx = index;
        if (idx !== (idx | 0)) {
            return void 0;
        }
        const size = this.size();
        if (idx < 0) {
            idx += size;
        }
        if (idx > size) {
            return void 0;
        }
        if (extraArgs.length > 0) {
            let k;
            let temp;
            let removed;
            let argumentsLength = extraArgs.length;
            const len = this.list.length;
            let argumentsIndex = 0;
            if (!size || idx < size / 2) {
                temp = new Array(idx);
                for (k = 0; k < idx; k++) {
                    temp[k] = this.list[(this.head + k) & this.capacityMask];
                }
                if (count === 0) {
                    removed = [];
                    if (idx > 0) {
                        this.head = (this.head + idx + len) & this.capacityMask;
                    }
                }
                else {
                    removed = this.remove(idx, count);
                    this.head = (this.head + idx + len) & this.capacityMask;
                }
                while (argumentsLength > argumentsIndex) {
                    this.unshift(extraArgs[--argumentsLength]);
                }
                for (k = idx; k > 0; k--) {
                    this.unshift(temp[k - 1]);
                }
            }
            else {
                temp = new Array(size - (idx + count));
                const tempLength = temp.length;
                for (k = 0; k < tempLength; k++) {
                    temp[k] = this.list[(this.head + idx + count + k) & this.capacityMask];
                }
                if (count === 0) {
                    removed = [];
                    if (idx !== size) {
                        this.tail = (this.head + idx + len) & this.capacityMask;
                    }
                }
                else {
                    removed = this.remove(idx, count);
                    this.tail = (this.tail - tempLength + len) & this.capacityMask;
                }
                while (argumentsIndex < argumentsLength) {
                    this.push(extraArgs[argumentsIndex++]);
                }
                for (k = 0; k < tempLength; k++) {
                    this.push(temp[k]);
                }
            }
            return removed;
        }
        else {
            return this.remove(idx, count);
        }
    }
splice ( index , count , ... extraArgs ) { let idx = index ; if ( idx !== ( idx | 0 ) ) { return void 0 ; } const size = this . size ( ) ; if ( idx < 0 ) { idx += size ; } if ( idx > size ) { return void 0 ; } if ( extraArgs . length > 0 ) { let k ; let temp ; let removed ; let argumentsLength = extraArgs . length ; const len = this . list . length ; let argumentsIndex = 0 ; if ( ! size || idx < size / 2 ) { temp = new Array ( idx ) ; for ( k = 0 ; k < idx ; k ++ ) { temp [ k ] = this . list [ ( this . head + k ) & this . capacityMask ] ; } if ( count === 0 ) { removed = [ ] ; if ( idx > 0 ) { this . head = ( this . head + idx + len ) & this . capacityMask ; } } else { removed = this . remove ( idx , count ) ; this . head = ( this . head + idx + len ) & this . capacityMask ; } while ( argumentsLength > argumentsIndex ) { this . unshift ( extraArgs [ -- argumentsLength ] ) ; } for ( k = idx ; k > 0 ; k -- ) { this . unshift ( temp [ k - 1 ] ) ; } } else { temp = new Array ( size - ( idx + count ) ) ; const tempLength = temp . length ; for ( k = 0 ; k < tempLength ; k ++ ) { temp [ k ] = this . list [ ( this . head + idx + count + k ) & this . capacityMask ] ; } if ( count === 0 ) { removed = [ ] ; if ( idx !== size ) { this . tail = ( this . head + idx + len ) & this . capacityMask ; } } else { removed = this . remove ( idx , count ) ; this . tail = ( this . tail - tempLength + len ) & this . capacityMask ; } while ( argumentsIndex < argumentsLength ) { this . push ( extraArgs [ argumentsIndex ++ ] ) ; } for ( k = 0 ; k < tempLength ; k ++ ) { this . push ( temp [ k ] ) ; } } return removed ; } else { return this . remove ( idx , count ) ; } }
Native splice implementation.
Native splice implementation .
// expect a number or return undefined