Skip to content

vinsidious/circularbuffer

Repository files navigation

circularbuffer

A small circular/ring buffer implementation in TypeScript.

Install

# using npm
npm install --save circularbuffer

# using yarn
yarn add circularbuffer

Usage

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]

Development

# build
yarn run build

# test
yarn run test

License

MIT © Vince Coppola

About

A small circular/ring buffer implementation in TypeScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published