circular-array

0.1.2 • Public • Published

Circular Array

Latest NPM release License Build Status

Simple circular array data structure, for storing a finite-length list of values and automatically dropping values that no longer fit in the array. All operations are O(1).

Usage

npm install --save circular-array
// ES6
import { CircularArray } from 'circular-array';
 
// CommonJS
const { CircularArray } = require('circular-array');
 
const gizmos = new CircularArray(3);
 
                     // gizmo.array() returns:
gizmos.push(gizmo1); //   [gizmo1]
gizmos.push(gizmo2); //   [gizmo1, gizmo2]
gizmos.push(gizmo3); //   [gizmo1, gizmo2, gizmo3]
gizmos.push(gizmo4); //   [gizmo4, gizmo2, gizmo3]

Package Sidebar

Install

npm i circular-array

Weekly Downloads

10

Version

0.1.2

License

MIT

Unpacked Size

9.01 kB

Total Files

14

Last publish

Collaborators

  • donmccurdy