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

typescript-data-structures

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-data-structures

A collection of TypeScript classes to create and use common data structures

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20
increased by566.67%
Maintainers
1
Weekly downloads
 
Created
Source

TSDS - TypeScript Data Structures

A collection of TypeScript classes to create and use common data structures

Installing

npm install typescript-data-structures

General Usage

Import the desired data structure in your file

import { LinkedList } from 'typescript-data-structures'

Instantiate class

private linkedList: LinkedList = new LinkedList();

Use class methods

this.linkedList.addToHead('new head');

API

LinkedList

MethodParametersReturnsWhat it does
addToHeadvalue: anyvoidadds new node and sets the head pointer to it, the old head becomes the new head's next
addToTailvalue: anyvoidadds new node and sets the tail pointer to it, the old tail becomes the new tail's prev
removeHeadvalue: anyhead.valueremoves head and sets new head to old head's next
removeTailvalue: anytail.valueremoves tail and sets new tail to old tail's prev
hasvalue: anyLinkedListNodereturns first node that contains the value or null
searchvalue: anyLinkedListNode[]returns array of nodes that contain the value or null

BinarySearchTree

MethodParametersReturnsWhat it does
setInsertCondition(value) => booleanvoidsets insertion rule
insertvalue: anyvoidinserts new node according to insert condition; if condition is not set, insertion will be done by simple comparison

Contributing

Contributing rules will follow

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

Radu Miron

Aknowledgements

Eric Traub - Data Structures in Javascript

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

FAQs

Package last updated on 06 Mar 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

  • 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