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

@thi.ng/dcons

Package Overview
Dependencies
Maintainers
1
Versions
306
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/dcons

Doubly linked list structure w/ iterator support

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.7K
decreased by-23.15%
Maintainers
1
Weekly downloads
 
Created
Source

@thi.ng/dcons

npm (scoped)

Double sided, doubly linked list with:

  • ES6 iterator support
  • Stack API (front & back)
  • Random node access (read / write, O(N/2))
  • Node insertion (also w/ custom comparator)
  • Rotation (left / right)
  • Splicing
  • Node finding
  • Node swapping

Usage

// ES5
DCons = require("@thi.ng/dcons").default;

// ES6 / TS
import DCons from "@thi.ng/dcons";

API

list = new DCons([1, 2, 3]);

Head centric

  • cons()
  • first()
  • drop()
  • setHead()

Tail centric

  • push()
  • peek()
  • pop()
  • setTail()

Random Access

  • .length
  • nth()
  • setNth()

Insertion

  • insertBefore()
  • insertAfter()
  • insertSorted()

Finding

  • find()
  • findWith()

Structure

  • copy()
  • splice()
  • swap()
  • rotateLeft()
  • rotateRight()

TODO...

Building

Build requirements

Building & testing this project requires Typescript and Mocha globally installed:

npm i typescript mocha -g
git clone https://github.com/thi-ng/dcons.git
cd dcons
npm up
npm run build

Testing

npm link mocha
npm run test

Authors

  • Karsten Schmidt

License

© 2017 Karsten Schmidt // Apache Software License 2.0

Keywords

FAQs

Package last updated on 30 Jul 2017

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