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

live-list

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

live-list

Fast linked list with live iterator

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

live-list.js Build Status

Fast linked list with live iterator. The list can be modified while iterating over the items.

Repository: https://github.com/mantoni/live-list.js


Install with npm

npm install live-list

Browser compatibility

To use this module in a browser, download the npm package and then use Browserify to create a standalone version.

Usage

var List = require('live-list').List;

var l = new List();
l.push(3);
l.unshift(1);
l.insert(2, 3);

var v, i = l.iterator();
while ((v = i.next()) !== undefined) {
  console.log(v);
}

List API

  • length: Reflects the number of items in the list
  • push(value): Appends a value to the list
  • unshift(value): Prepends a value to the list
  • insert(value, before): Inserts a value before another value
  • remove(value): Removes the given value from the list
  • removeAll(): Removes all values from the list
  • toArray(): Returns a new array with all values in the list
  • iterator(): Returns a new Iterator

Iterator API

The iterator is derived from min-iterator and extends the API with these functions:

  • insert(value): Inserts a value into the list before the value returned by the last call to next()
  • remove(): Removes the value from the list that was returned by the last call to next()

License

MIT

FAQs

Package last updated on 17 Dec 2013

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