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

ts-structures

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-structures - npm Package Compare versions

Comparing version 0.5.3 to 0.5.4

3

package.json
{
"name": "ts-structures",
"version": "0.5.3",
"version": "0.5.4",
"description": "TypeScript implementation of common data structures",
"main": "index.js",
"types": "index.d.ts",
"keywords": [

@@ -7,0 +8,0 @@ "typescript",

@@ -18,2 +18,7 @@ import { CappedStructure } from '../_shared';

values: BinaryHeap<PriorityQueueNode<T>>;
/**
* The maximum elements the structure can contain.
* It can be set via the constructor or `setCapacity`.
* Default value is `-1` (no limit).
*/
capacity: number;

@@ -28,2 +33,5 @@ /**

constructor(capacity?: number);
/**
* The current amount of elements.
*/
get length(): number;

@@ -36,4 +44,3 @@ /**

* @param value - The value associed to the element.
* @returns The length of the current Queue after insertion,
* or `-1` if it failed.
* @returns The inserted element or `undefined` if it failed.
*/

@@ -44,3 +51,3 @@ enqueue(value: T, priority: number): PriorityQueueNode<T> | undefined;

*
* @returns The value of the element removed.
* @returns The removes element or `undefined` if it failed.
*/

@@ -47,0 +54,0 @@ dequeue(): PriorityQueueNode<T> | undefined;

@@ -38,2 +38,7 @@ "use strict";

constructor(capacity) {
/**
* The maximum elements the structure can contain.
* It can be set via the constructor or `setCapacity`.
* Default value is `-1` (no limit).
*/
this.capacity = -1;

@@ -49,2 +54,5 @@ // higher priority -\> lower priority number, so we set a custom compareFunction

}
/**
* The current amount of elements.
*/
get length() {

@@ -59,4 +67,3 @@ return !this.values ? 0 : this.values.length;

* @param value - The value associed to the element.
* @returns The length of the current Queue after insertion,
* or `-1` if it failed.
* @returns The inserted element or `undefined` if it failed.
*/

@@ -70,3 +77,3 @@ enqueue(value, priority) {

*
* @returns The value of the element removed.
* @returns The removes element or `undefined` if it failed.
*/

@@ -73,0 +80,0 @@ dequeue() {

@@ -16,3 +16,11 @@ import { CappedStructure } from '../_shared';

declare class Queue<T> implements CappedStructure {
/**
* The current amount of elements.
*/
length: number;
/**
* The maximum elements the structure can contain.
* It can be set via the constructor or `setCapacity`.
* Default value is `-1` (no limit).
*/
capacity: number;

@@ -19,0 +27,0 @@ private _first?;

@@ -36,3 +36,11 @@ "use strict";

constructor(capacity) {
/**
* The current amount of elements.
*/
this.length = 0;
/**
* The maximum elements the structure can contain.
* It can be set via the constructor or `setCapacity`.
* Default value is `-1` (no limit).
*/
this.capacity = -1;

@@ -39,0 +47,0 @@ if (capacity && capacity > 0)

@@ -13,3 +13,11 @@ import { CappedStructure } from '../_shared';

declare class Stack<T> implements CappedStructure {
/**
* The current amount of elements.
*/
length: number;
/**
* The maximum elements the structure can contain.
* It can be set via the constructor or `setCapacity`.
* Default value is `-1` (no limit).
*/
capacity: number;

@@ -16,0 +24,0 @@ front?: StackNode<T>;

@@ -33,3 +33,11 @@ "use strict";

constructor(capacity) {
/**
* The current amount of elements.
*/
this.length = 0;
/**
* The maximum elements the structure can contain.
* It can be set via the constructor or `setCapacity`.
* Default value is `-1` (no limit).
*/
this.capacity = -1;

@@ -36,0 +44,0 @@ if (capacity && capacity > 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