Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

AlexMasterov/fixed-circular-buffer.js

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fixed Circular Buffer

A tiny, fast and heap safe singly-linked list of fixed-size (2048) circular buffers.

npm GitHub license Build Status Coverage Status

Installation

# npm
npm install fixed-circular-buffer

# yarn
yarn add fixed-circular-buffer

Usage

const CircularBuffer = require('fixed-circular-buffer')

const Q = new CircularBuffer()

Q.push('xyz')

Q.size        // 1
Q.length      // 2048

Q.shift()     // 'xyz'
Q.shift()     // null

let i = 2049  // data items
while (i > 0) Q.push(i -= 1)

Q.size        // 2049
Q.length      // 4096

Tests

Run tests as follows:

npm run test

License

Copyright © 2018–2019 Alex Masterov <alex.masterow@gmail.com>

Fixed Circular Buffer is licensed under MIT and can be used for any personal or commercial project.

About

A tiny (232 bytes) and fast Circular Buffer implementation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.