remove(index, count) {
        let idx = index;
        let removed;
        let deletionCount = count;
        // expect a number or return undefined
        if (idx !== (idx | 0)) {
            return void 0;
        }
        if (this.head === this.tail) {
            return void 0;
        }
        const size = this.size();
        const len = this.list.length;
        if (idx >= size || idx < -size || count < 1) {
            return void 0;
        }
        if (idx < 0) {
            idx += size;
        }
        if (count === 1 || !count) {
            removed = new Array(1);
            removed[0] = this.removeOne(idx);
            return removed;
        }
        if (idx === 0 && idx + count >= size) {
            removed = this.toArray();
            this.clear();
            return removed;
        }
        if (idx + count > size) {
            count = size - idx;
        }
        let k;
        removed = new Array(count);
        for (k = 0; k < count; k++) {
            removed[k] = this.list[(this.head + idx + k) & this.capacityMask];
        }
        idx = (this.head + idx) & this.capacityMask;
        if (index + count === size) {
            this.tail = (this.tail - count + len) & this.capacityMask;
            for (k = count; k > 0; k--) {
                this.list[(idx = (idx + 1 + len) & this.capacityMask)] = void 0;
            }
            return removed;
        }
        if (index === 0) {
            this.head = (this.head + count + len) & this.capacityMask;
            for (k = count - 1; k > 0; k--) {
                this.list[(idx = (idx + 1 + len) & this.capacityMask)] = void 0;
            }
            return removed;
        }
        if (idx < size / 2) {
            this.head = (this.head + index + count + len) & this.capacityMask;
            for (k = index; k > 0; k--) {
                this.unshift(this.list[(idx = (idx - 1 + len) & this.capacityMask)]);
            }
            idx = (this.head - 1 + len) & this.capacityMask;
            while (deletionCount > 0) {
                this.list[(idx = (idx - 1 + len) & this.capacityMask)] = void 0;
                deletionCount--;
            }
            if (index < 0) {
                this.tail = idx;
            }
        }
        else {
            this.tail = idx;
            idx = (idx + count + len) & this.capacityMask;
            for (k = size - (count + index); k > 0; k--) {
                this.push(this.list[idx++]);
            }
            idx = this.tail;
            while (deletionCount > 0) {
                this.list[(idx = (idx + 1 + len) & this.capacityMask)] = void 0;
                deletionCount--;
            }
        }
        if (this.head < 2 && this.tail > 10000 && this.tail <= len >>> 2) {
            this.shrinkArray();
        }
        return removed;
    }
/**
     * Remove number of items from the specified index from the list.
     * Returns array of removed items.
     * Returns undefined if the list is empty.
     * @param index
     * @param count
     * @returns {array}
     */
Remove number of items from the specified index from the list.
Returns array of removed items.
Returns undefined if the list is empty.
@param index
@param count
@returns {array}
Remove number of items from the specified index from the list . Returns array of removed items . Returns undefined if the list is empty . @param index @param count @returns { array }
remove(index, count) {
        let idx = index;
        let removed;
        let deletionCount = count;
        if (idx !== (idx | 0)) {
            return void 0;
        }
        if (this.head === this.tail) {
            return void 0;
        }
        const size = this.size();
        const len = this.list.length;
        if (idx >= size || idx < -size || count < 1) {
            return void 0;
        }
        if (idx < 0) {
            idx += size;
        }
        if (count === 1 || !count) {
            removed = new Array(1);
            removed[0] = this.removeOne(idx);
            return removed;
        }
        if (idx === 0 && idx + count >= size) {
            removed = this.toArray();
            this.clear();
            return removed;
        }
        if (idx + count > size) {
            count = size - idx;
        }
        let k;
        removed = new Array(count);
        for (k = 0; k < count; k++) {
            removed[k] = this.list[(this.head + idx + k) & this.capacityMask];
        }
        idx = (this.head + idx) & this.capacityMask;
        if (index + count === size) {
            this.tail = (this.tail - count + len) & this.capacityMask;
            for (k = count; k > 0; k--) {
                this.list[(idx = (idx + 1 + len) & this.capacityMask)] = void 0;
            }
            return removed;
        }
        if (index === 0) {
            this.head = (this.head + count + len) & this.capacityMask;
            for (k = count - 1; k > 0; k--) {
                this.list[(idx = (idx + 1 + len) & this.capacityMask)] = void 0;
            }
            return removed;
        }
        if (idx < size / 2) {
            this.head = (this.head + index + count + len) & this.capacityMask;
            for (k = index; k > 0; k--) {
                this.unshift(this.list[(idx = (idx - 1 + len) & this.capacityMask)]);
            }
            idx = (this.head - 1 + len) & this.capacityMask;
            while (deletionCount > 0) {
                this.list[(idx = (idx - 1 + len) & this.capacityMask)] = void 0;
                deletionCount--;
            }
            if (index < 0) {
                this.tail = idx;
            }
        }
        else {
            this.tail = idx;
            idx = (idx + count + len) & this.capacityMask;
            for (k = size - (count + index); k > 0; k--) {
                this.push(this.list[idx++]);
            }
            idx = this.tail;
            while (deletionCount > 0) {
                this.list[(idx = (idx + 1 + len) & this.capacityMask)] = void 0;
                deletionCount--;
            }
        }
        if (this.head < 2 && this.tail > 10000 && this.tail <= len >>> 2) {
            this.shrinkArray();
        }
        return removed;
    }
remove ( index , count ) { let idx = index ; let removed ; let deletionCount = count ; if ( idx !== ( idx | 0 ) ) { return void 0 ; } if ( this . head === this . tail ) { return void 0 ; } const size = this . size ( ) ; const len = this . list . length ; if ( idx >= size || idx < - size || count < 1 ) { return void 0 ; } if ( idx < 0 ) { idx += size ; } if ( count === 1 || ! count ) { removed = new Array ( 1 ) ; removed [ 0 ] = this . removeOne ( idx ) ; return removed ; } if ( idx === 0 && idx + count >= size ) { removed = this . toArray ( ) ; this . clear ( ) ; return removed ; } if ( idx + count > size ) { count = size - idx ; } let k ; removed = new Array ( count ) ; for ( k = 0 ; k < count ; k ++ ) { removed [ k ] = this . list [ ( this . head + idx + k ) & this . capacityMask ] ; } idx = ( this . head + idx ) & this . capacityMask ; if ( index + count === size ) { this . tail = ( this . tail - count + len ) & this . capacityMask ; for ( k = count ; k > 0 ; k -- ) { this . list [ ( idx = ( idx + 1 + len ) & this . capacityMask ) ] = void 0 ; } return removed ; } if ( index === 0 ) { this . head = ( this . head + count + len ) & this . capacityMask ; for ( k = count - 1 ; k > 0 ; k -- ) { this . list [ ( idx = ( idx + 1 + len ) & this . capacityMask ) ] = void 0 ; } return removed ; } if ( idx < size / 2 ) { this . head = ( this . head + index + count + len ) & this . capacityMask ; for ( k = index ; k > 0 ; k -- ) { this . unshift ( this . list [ ( idx = ( idx - 1 + len ) & this . capacityMask ) ] ) ; } idx = ( this . head - 1 + len ) & this . capacityMask ; while ( deletionCount > 0 ) { this . list [ ( idx = ( idx - 1 + len ) & this . capacityMask ) ] = void 0 ; deletionCount -- ; } if ( index < 0 ) { this . tail = idx ; } } else { this . tail = idx ; idx = ( idx + count + len ) & this . capacityMask ; for ( k = size - ( count + index ) ; k > 0 ; k -- ) { this . push ( this . list [ idx ++ ] ) ; } idx = this . tail ; while ( deletionCount > 0 ) { this . list [ ( idx = ( idx + 1 + len ) & this . capacityMask ) ] = void 0 ; deletionCount -- ; } } if ( this . head < 2 && this . tail > 10000 && this . tail <= len >>> 2 ) { this . shrinkArray ( ) ; } return removed ; }
Remove number of items from the specified index from the list.
Remove number of items from the specified index from the list .
// expect a number or return undefined