* Removes and returns the first item in the buffer.
()
| 146 | * Removes and returns the first item in the buffer. |
| 147 | */ |
| 148 | shift(): T { |
| 149 | if (this.isEmpty()) { |
| 150 | throw new RangeError('Ring buffer is empty.'); |
| 151 | } |
| 152 | const result = this.get(this.begin); |
| 153 | this.set(this.begin, undefined); |
| 154 | this.begin = this.wrap(this.begin + 1); |
| 155 | return result; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Removes and returns a specific item in the buffer, and moves the last item |
no test coverage detected