@busieinc/ts-datastructures
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

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();


Package Sidebar

Install

npm i @busieinc/ts-datastructures

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

20.9 kB

Total Files

13

Last publish

Collaborators

  • chalk.busie
  • bperry