A small circular/ring buffer implementation in TypeScript.
# using npm
npm install --save circularbuffer
# using yarn
yarn add circularbuffer
import CircularBuffer from 'circularbuffer';
const queue = new CircularBuffer<string|number>(5);
queue.enq('foo');
queue.enq('bar', 'baz');
queue.toArray(); // ['foo', 'bar', 'baz']
queue.size; // 3
queue.capacity; // 5
queue.replace(1, 2, 3, 4, 5, 6, 7);
queue.toArray(); // [3, 4, 5, 6, 7]
# build
yarn run build
# test
yarn run test
MIT © Vince Coppola