JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7296
  • Score
    100M100P100Q132991F
  • License MIT

A circular array buffer written in modern TypeScript.

Package Exports

  • ring-buffer-ts

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ring-buffer-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Ring Buffer

Aka "circular buffer" written in TypeScript

  • Well tested.
  • Documentation (included declaration types and doc-comments).
  • Clean and modern code.
  • Written in TypeScript (strict mode and strongly typed).
  • Easy API.
  • High performance when adding items.
  • No dependencies.
  • NodeJS, Browser.
  • Tiny size.

Missing feature? Note that you can export and import the buffer as array and you can do what ever you want with the array. You can also consider to create an issue here and pull-request to add features.

Install

npm i ring-buffer-ts

NPM Package

Usage

import { RingBuffer } from 'ring-buffer-ts';

const ringBuffer = new RingBuffer<number>(5);
ringBuffer.add(1);
ringBuffer.add(2, 3);
ringBuffer.add(4, 5, 6);

console.log(ringBuffer.toArray());
// Result: [2, 3, 4, 5, 6]

Documentation