1.1.1 • Published 3 years ago

@busieinc/ts-datastructures v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

TS Datastructures

Common Datastructures built here for re-use across projects via NPM Install

Installation

npm install @busieinc/ts-datastructures

Usage

Linked List

import { LinkedList } from '@busieinc/ts-datastructures'

const ll = new LinkedList<string>();
node = ll.insertInBeginning('this is the head node');                   // Node('this is the head node') -> null
anotherNode = ll.insertAtEnd('this is the tail node');									// Node('this is the head node') <--> Node('this is the tail node') -> null

for (const data in ll.traverse()) {                                     // NOTE: LinkedList.prototype.traverse returns a generator
	console.log(data);
}

const headNodeFromSearch = ll.search((data) => data.includes('head'));  // headNodeFromSearch === node

ll.removeFromBeginning();																								// Node('this is the tail node') -> null
ll.removeFromEnd();
1.1.1

3 years ago

1.0.2

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago