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 - npm Package Compare versions

Comparing version 0.0.7 to 1.0.0

3

index.d.ts

@@ -0,1 +1,2 @@

import { LinkedListNode } from './helper-classes';
export declare class LinkedList {

@@ -8,2 +9,4 @@ private head;

removeTail(): any;
has(value: any): LinkedListNode;
search(value: any): any;
}

@@ -57,4 +57,30 @@ "use strict";

};
LinkedList.prototype.has = function (value) {
var currentNode = this.head;
while (currentNode) {
if (currentNode.value = value) {
return currentNode;
}
currentNode = currentNode.next;
}
return null;
};
LinkedList.prototype.search = function (value) {
var currentNode = this.head;
var result = [];
while (currentNode) {
if (currentNode.value === value) {
result.push(currentNode);
}
currentNode = currentNode.next;
}
if (result.length && result.length > 1) {
return result;
}
else {
return -1;
}
};
return LinkedList;
}());
exports.LinkedList = LinkedList;

2

package.json
{
"name": "typescript-data-structures",
"version": "0.0.7",
"version": "1.0.0",
"description": "A collection of TypeScript classes to create and use common data structures",

@@ -5,0 +5,0 @@ "author": "RCMiron",

@@ -28,2 +28,14 @@ # TSDS - TypeScript Data Structures

```
## API
###LinkedList
Method | Paramenters | Returns
--- | --- | ---
addToHead | value: any | void
addToTail | value: any | void
removeHead | value: any | head.value
removeTail | value: any | tail.value
has | value: any | first node that contains the value
search | value: any | array of nodes that contain the value or -1
## Contributing

@@ -40,2 +52,6 @@

## Aknowledgements
[Eric Traub - Data Structures in Javascript](https://www.udemy.com/learning-data-structures-in-javascript-from-scratch)
## License

@@ -42,0 +58,0 @@

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