* Removes and returns the last item in the buffer.
()
| 122 | * Removes and returns the last item in the buffer. |
| 123 | */ |
| 124 | pop(): T { |
| 125 | if (this.isEmpty()) { |
| 126 | throw new RangeError('Ring buffer is empty.'); |
| 127 | } |
| 128 | this.end = this.wrap(this.end - 1); |
| 129 | const result = this.get(this.end); |
| 130 | this.set(this.end, undefined); |
| 131 | return result; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Adds an item to the beginning of the buffer. |
no test coverage detected