/** * First-in, first-out (FIFO) buffer (queue) with default item values. * Optionally circular based on {@link Buffer.limit}. * Can be switched to LIFO with {@link Buffer#reverse}. */ export default class Buffer { #private; /** The length after which the buffer becomes circular, i.e., discards oldest items. */ readonly limit: number; length: number; constructor( /** The length after which the buffer becomes circular, i.e., discards oldest items. */ limit?: number); /** * Add an item to the end of the buffer. */ enqueue(value: A): void; /** * Return the oldest item from the buffer. */ dequeue(): A; clear(): void; forEach(f: (value: A) => void): void; reverse(): this; [Symbol.iterator](): { next: () => { value: A; done: false; } | { done: true; value: undefined; }; [Symbol.iterator](): any; }; static from(iterable: Iterable, limit: number): Buffer; }