A small circular/ring buffer implementation in TypeScript.
npm install circularbufferA small circular/ring buffer implementation in TypeScript.
``shusing npm
npm install --save circularbuffer
Usage
`ts
import CircularBuffer from 'circularbuffer';const queue = new CircularBuffer(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]
`Development
`sh
build
yarn run buildtest
yarn run test
``MIT © Vince Coppola