JSPM

circular-array

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

Simple circular array data structure, for storing a finitely-sized list of values

Package Exports

  • circular-array

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

Readme

Circular Array

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]