A circular buffer (ring buffer) implementation for JavaScript that aims to replicate the full Array.prototype API. Version 2.2.0 is the latest stable release; the project appears to be in maintenance mode with infrequent updates. Key differentiators: provides overflow callback, rotation methods (rotateLeft/rotateRight), sortedIndex, and get/set methods. Includes TypeScript definitions. Lightweight with no external dependencies.
npm install CBufferNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a circular buffer, demonstrates push with auto-overwrite, overflow callback, rotateLeft, and sorting.
Check the documentation for the implemented API before relying on a standard array method.
Always pass a custom comparator to sort() for predictable behavior.
Pass multiple arguments to initialize with values, or use a CBuffer with size then push.
Always use lowercase 'cbuffer' when installing or importing.
Use const CBuffer = require('cbuffer').default; or switch to import statement.npm install cbuffer and import from 'cbuffer' (lowercase).
Use toArray() to convert to a regular array first: buffer.toArray().map(...).
No dependency data recorded yet.