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

connective-tissue

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connective-tissue

[![Build Status](https://travis-ci.com/MatthewZito/connective-tissue.svg?branch=master)](https://travis-ci.com/MatthewZito/connective-tissue) [![npm version](https://badge.fury.io/js/connective-tissue.svg)](https://badge.fury.io/js/connective-tissue) [![L

  • 1.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status npm version License: MIT

connective-tissue

connective-tissue is a collection of linked list and ring data structures implemented in and for JavaScript. The structures in this library follow the specifications of their classical counterparts; they are well-tested and optimal implementations of:

  • singly linked list
  • doubly linked list *
  • header linked list *
  • circular singly linked list
  • circular doubly linked list

*work in progress

Installation

npm install connective-tissue

OR

yarn add connective-tissue

Supported Environments

connective-tissue currently supports UMD, CommonJS (node versions >= 10), and ESM build-targets

API Reference

Modules

Atomics

Classes

CircularDoublyLinkedList
CircularSinglyLinkedList


Atomics


Atomics.Node


new Node(value)

Implements a bi-directional node

Node implements as a member a pointer to the list to which it belongs

ParamType
valueany


Atomics.ForwardNode


new ForwardNode(value)

Implements a uni-directional (forward) node

ForwardNode implements as a member a pointer to the list to which it belongs

ParamType
valueany


Atomics.Sentinel


new Sentinel()

Implements a ring data structure for terminating a bi-directional list


CircularDoublyLinkedList


new CircularDoublyLinkedList()

Implements a circular doubly linked list as a ring, such that the sentinel node is both the next node of the tail, and the previous node of the head


circularDoublyLinkedList.sentinel

The sentinel terminator node

Properties

Type
Sentinel


circularDoublyLinkedList.length

The list length, sans the sentinel terminator

Properties

Type
number


circularDoublyLinkedList.size() ⇒ number

The current size of the list, sans the sentinel node


circularDoublyLinkedList.next(node) ⇒ Node | null

Returns the next list node, if extant; else, null

ParamType
nodeNode


circularDoublyLinkedList.prev(node) ⇒ Node | null

Returns the previous list node, if extant; else, null

ParamType
nodeNode


circularDoublyLinkedList.head() ⇒ Node | null

Returns the head node of the list or null if the list is empty


circularDoublyLinkedList.tail() ⇒ Node | null

Returns the tail node of the list or null if the list is empty


circularDoublyLinkedList.insert(node, at) ⇒ Node

Insert a new node after a given node at

ParamType
nodeNode
atNode


circularDoublyLinkedList.remove(node) ⇒ Node

Remove a given node from the list

Returns: Node - The removed node

ParamType
nodeNode


circularDoublyLinkedList.pop(node) ⇒ Node

Remove the last node from the list

Returns: Node - The removed node

ParamType
nodeNode


circularDoublyLinkedList.move(node, at) ⇒ Node

Move given node to at

ParamType
nodeNode
atNode


circularDoublyLinkedList.pushFront(value) ⇒ Node

Push a new node with value value to the front of the list

ParamType
valueany


circularDoublyLinkedList.pushBack(value) ⇒ Node

Push a new node with value value to the back of the list

ParamType
valueany


circularDoublyLinkedList.insertBefore(value, mark) ⇒ Node

Insert a new node with value value immediately before mark

If mark is not an element of the list, the list is not modified

mark must not be null

ParamType
valueany
markNode


circularDoublyLinkedList.insertAfter(value, mark) ⇒ Node

Insert a new node with value value immediately after mark

If mark is not an element of the list, the list is not modified

mark must not be null

ParamType
valueany
markNode


circularDoublyLinkedList.moveToFront(node) ⇒ Node

Move a node to the front of the list

If the given node is not an element of the list, the list is not modified

The given node must not be null

ParamType
nodeNode


circularDoublyLinkedList.moveToBack(node) ⇒ Node

Move a node to the back of the list

If the given node is not an element of the list, the list is not modified

The given node must not be null

ParamType
nodeNode


circularDoublyLinkedList.moveBefore(node, mark) ⇒ Node

Move a given node to its new position before mark

If either the given node or mark are not an element of the list, or node == mark, the list is not modified

Both the node and mark must not be null

ParamType
nodeNode
markNode


circularDoublyLinkedList.moveAfter(node, mark) ⇒ Node

Move a given node to its new position after mark

If either the given node or mark are not an element of the list, or node == mark, the list is not modified

Both the node and mark must not be null

ParamType
nodeNode
markNode


circularDoublyLinkedList.insertValue(value, at) ⇒ Node

Convenience for inserting a given value into a new node after a given node at

ParamType
valueany
atNode


circularDoublyLinkedList.pushBackList(other)

Insert a copy of another list at the back of the caller list

The lists may be the same, but must not be null

ParamType
otherCircularDoublyLinkedList


circularDoublyLinkedList.pushFrontList(other)

Insert a copy of another list at the front of the caller list

The lists may be the same, but must not be null

ParamType
otherCircularDoublyLinkedList


CircularDoublyLinkedList.create() ⇒ CircularDoublyLinkedList

Instantiate an empty circular doubly linked list


CircularSinglyLinkedList


new CircularSinglyLinkedList()

Implements a circular singular (linear) linked list


circularSinglyLinkedList.head

The head node; implemented internally as a ring

Properties

Type
ForwardNode


circularSinglyLinkedList.length

The current size of the list

Properties

Type
number


circularSinglyLinkedList.size() ⇒ number

The current size of the list


circularSinglyLinkedList.next(node) ⇒ Node | null

Returns the next list node, if extant; else, null

ParamType
nodeForwardNode


circularSinglyLinkedList.prev(node) ⇒ Node | null

Returns the previous list node, if extant; else, null

ParamType
nodeForwardNode


circularSinglyLinkedList.remove(node) ⇒ Node | null

Remove a given node from the list

Returns: Node | null - The removed node

ParamType
nodeForwardNode


circularSinglyLinkedList.pop(node) ⇒ Node | null

Remove the last node from the list

Returns: Node | null - The removed node

ParamType
nodeForwardNode


circularSinglyLinkedList.moveAfter(node, mark) ⇒ ForwardNode

Move a given node to its new position after mark

If either the given node or mark are not an element of the list; node == mark; or mark.next == node, the list is not modified

Both the node and mark must not be null

ParamType
nodeForwardNode
markForwardNode


circularSinglyLinkedList.moveBefore(node, mark) ⇒ ForwardNode

Move a given node to its new position before mark

If either the given node or mark are not an element of the list; node == mark; or node.next == mark, the list is not modified

Both the node and mark must not be null

ParamType
nodeForwardNode
markForwardNode


circularSinglyLinkedList.pushFront(value) ⇒ ForwardNode

Push a new node with value value to the front of the list

ParamType
valueany


circularSinglyLinkedList.pushBack(value) ⇒ ForwardNode

Push a new node with value value to the back of the list

ParamType
valueany


circularSinglyLinkedList.insertAfter(value, mark) ⇒ ForwardNode | null

Insert a new node with value value immediately after mark

If mark is not an element of the list, the list is not modified

mark must not be null

ParamType
valueany
markForwardNode


circularSinglyLinkedList.insertBefore(value, mark) ⇒ ForwardNode | null

Insert a new node with value value immediately before mark

If mark is not an element of the list, the list is not modified

mark must not be null

ParamType
valueany
markForwardNode


circularSinglyLinkedList.pushBackList(other)

Insert a copy of another list at the back of the caller list

The lists may be the same, but must not be null

ParamType
otherCircularSinglyLinkedList


circularSinglyLinkedList.pushFrontList(other)

Insert a copy of another list at the front of the caller list

The lists may be the same, but must not be null

ParamType
otherCircularSinglyLinkedList


CircularSinglyLinkedList.create() ⇒ CircularSinglyLinkedList

Instantiate an empty circular singly linked list

FAQs

Package last updated on 09 Jun 2021

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