Socket
Book a DemoInstallSign in
Socket

tcc-linkedlist

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

tcc-linkedlist

Liked list in javascript

0.0.7
latest
npmnpm
Version published
Maintainers
1
Created
Source

Fast and simple linked list program for node.

let {SingleLinkedList, DoubleLinkedList} = require('tcc-linkedlist')
let sll = new SingleLinkedList()
let dll = new DoubleLinkedList()

//  objects to add to linked list
let collinObject = {
    name: 'Collin',
    age: 21
}

let timObject = {
    name: 'Timothy',
    age: 21
}

let daveObject = {
    name: 'David',
    age: 24
}

//  a static id is generated for each created node 0, .. n
sll.createNode(collinObject)
sll.createNode(timObject)
sll.createNode(daveObject)

dll.createNode(collinObject)
dll.createNode(timObject)
dll.createNode(daveObject)

//  delete timObject in linked list
sll.deleteNodeById(1)
dll.deleteNodeById(1)

//  print the linked list
sll.printLinkedList()
dll.printLinkedList()

let singleNode = sll.getNodeById(2) //  returns daveObject as SingleModel object
let singleObj = sll.getObjectById(2)   //  returns daveObject

let doubleNode = dll.getNodeById(2) //  returns daveObject as DoubleModel object
let doubleObj = dll.getObjectById(2)   //  returns daveObject

let singlePrevNode = sll.getPreviousNodeById(2) //  returns collinObject as SingleModel
let doublePrevNode = dll.getPreviousNodeById(2) //  returns collinObject as DoubleModel

let singleCollinObject = sll.removeNodeProperties(singlePrevNode)   //  collinObject is equal to singleCollinObject
let doubleCollinObject = dll.removeNodeProperties(doublePrevNode)   //  collinObject is equal to doubleCollinObject

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js.

Installation is done using the npm install command:

$ npm install tcc-linkedlist

Features

  • Single Linked List
  • Double Linked List

License

ISC

Keywords

Linked List

FAQs

Package last updated on 14 May 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.