Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

CBuffer

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

CBuffer

Circular Buffer JavaScript implementation

  • 0.0.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12K
decreased by-18.29%
Maintainers
1
Weekly downloads
 
Created
Source

JavaScript Circular Buffer Utility

The end goal of this project is to implement the entire JavaScript Array.prototype, and some additional utility methods, as a circular buffer.

As JavaScript is used for more and more computationally intensive tasks, it's important to reduce execution and garbage collection time. By using a circular buffer instead of a native array less extraneous data bits are generated that will need to be cleaned up later. So use of this library is two fold: First, if you need a circular buffer for the classical reasons (animation queue, video streaming) this library can help you out. Second, if you know the maximum size of an array you'll be working with, using CBuffer can drastically reduce the memory footprint of your application.

While the entire Array.prototype API is on the roadmap, it's not all quite here. Below is the currently implemented API.

API

Mutator Methods
  • pop()
  • push()
  • reverse()
  • shift()
  • sort()
  • unshift()
Accessor Methods
  • indexOf()
  • lastIndexOf()
Iteration Methods
  • every()
  • forEach()
  • some()
Utility Methods
  • empty()
  • first()
  • last()
  • get()
  • set()
  • toArray() - Return clean ordered array of buffer
  • overflow - Set to function and will be called when data is about to be overwritten

FAQs

Package last updated on 17 Apr 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc