circularbuffer
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

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

Package Sidebar

Install

npm i circularbuffer

Weekly Downloads

246

Version

0.1.1

License

MIT

Last publish

Collaborators

  • vincecoppola