JSPM

easy-circular-buffer

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

Easy to use and high performance circular buffer

Package Exports

  • easy-circular-buffer

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 (easy-circular-buffer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

easy-circular-buffer

Easy to use and high performance circular buffer

Installation

npm i easy-circular-buffer

Usage

const { createCircularBuffer } = require('easy-circular-buffer')

const cb = createCircularBuffer(length)

Methods
  • cb.insert() <*void*> Insert item into circular buffer.
  • cb.peekNewest() <*any*> Returns the newest item inserted in the circular buffer.
  • cb.peekOldest() <*any*> Returns the oldest item inserted in the circular buffer.
  • cb.toArray() <Array<*any*>> Returns an array sorted from oldest (at index 0) to newest item.