easy-circular-buffer

1.0.1 • Public • Published

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.

Dependents (0)

Package Sidebar

Install

npm i easy-circular-buffer

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

3.64 kB

Total Files

4

Last publish

Collaborators

  • adm91