New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sb-js-data-structures

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sb-js-data-structures

JavaScript Data Structure written in TypeScript

  • 1.0.4
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-44.44%
Maintainers
1
Weekly downloads
 
Created
Source

Data Structures

JavaScript Data Structure written in TypeScript

Summary

Installation and Usage

Server-side:

Using npm:

npm install sb-ds-data-structures

Then where needed:

Typescript
import { LinkedList } from 'sb-js-data-structures'

const list = new LinkedList()

list.addToLast(1)
list.addToLast(2)

Documentation

Linked List

Creates a Linked List, a data structure where each element is a separate object and the elements are linked using pointers.

Linked List

Initializer
import { LinkedList } from 'sb-js-data-structures'

const list = new LinkedList()
Methods
addToLast
public addToLast(element: T): void
Parameters
  • element T - The element to be inserted
Description

Insert an element to the ending of the Linked List.

addToHead
public addToHead(element: T): void
Parameters
  • element T - The element to be inserted
Description

Insert an element to the beginning of the Linked List.

addElementAtPosition
public addElementAtPosition(element: T, position: number): void
Parameters
  • element T - The element to be inserted
  • position number - position where the element should be inserted
Description

Insert an element to a specific position of the Linked List, since position is less then the number of elements of the Linked List.

removeFromLast
public removeFromLast(): void
Description

Remove the element on the ending of the Linked List.

removeFromHead
public removeFromHead(): void
Description

Remove the element on the beginning of the Linked List.

removeFirstElementFoundFromList
public removeFirstElementFoundFromList(element: T): void
Parameters
  • element T - The element to be removed
Description

Remove the first element found on the Linked List.

removeAllElementsFromList
public removeAllElementsFromList(element: T): void
Parameters
  • element T - The element to be removed
Description

Remove all the elements found on the Linked List.

reverse
public reverse(): void
Description

Reverse the Linked List.

fromArray
public fromArray(element: T[]): void
Parameters
  • elements T[] - Array of elements
Description

Insert all the elements at the ending of the Linked List.

toArray
public toArray(): T[]
Description

Create an array with all the elements of the Linked List.

getLength
public getLength(): number
Description

Get the length of the Linked List.

isEmpty
public isEmpty(): boolean
Returns
  • boolean - Returns true if the Linked List has no elements, otherwise, returns false.
Description

Informs if the Linked List is empty.

print
public isEmpty(): boolean
Description

Console log the Linked List elements.

License

MIT

Keywords

FAQs

Package last updated on 25 Sep 2020

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