A TypeScript/JavaScript implementation of a circular buffer (ring buffer, cyclic queue) with 100% code and property coverage. Current stable version is 1.10.0. Released regularly with no notable release cadence. Key differentiators: zero runtime dependencies, multiple build outputs (ESM module, CommonJS, IIFE), TypeScript types included, and extensive testing. Compared to alternatives like 'buffer' or simple arrays, it provides a fixed-size FIFO data structure with efficient push/pop and additional utility methods like shove, resize, and reverse.
npm install circular_buffer_jsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a circular buffer, pushing/popping elements, checking state, shoving with overflow, toArray, resize, and clear.
Specify pE explicitly if you want to control truncation direction.
Ensure capacity is greater than 0 for normal use.
Use 'shove' to automatically evict oldest element when full, or call 'resize' to increase capacity.
Use 'import { circular_buffer } from 'circular_buffer_js'' (with curly braces).Either check 'isFull' before pushing, or use 'shove' method instead of 'push'.
Ensure you instantiate a circular_buffer instance: 'const cb = new circular_buffer(size)'.
No dependency data recorded yet.