min-heap-typed
Advanced tools
Comparing version 1.38.8 to 1.38.9
@@ -80,6 +80,7 @@ /** | ||
* @param {number} max - The max count of words will be found | ||
* @param isAllWhenEmptyPrefix - If true, when the prefix provided as '', returns all the words in the trie. | ||
* @returns {string[]} an array of strings. | ||
*/ | ||
getWords(prefix?: string, max?: number): string[]; | ||
getWords(prefix?: string, max?: number, isAllWhenEmptyPrefix?: boolean): string[]; | ||
private _caseProcess; | ||
} |
@@ -229,5 +229,6 @@ "use strict"; | ||
* @param {number} max - The max count of words will be found | ||
* @param isAllWhenEmptyPrefix - If true, when the prefix provided as '', returns all the words in the trie. | ||
* @returns {string[]} an array of strings. | ||
*/ | ||
getWords(prefix = '', max = Number.MAX_SAFE_INTEGER) { | ||
getWords(prefix = '', max = Number.MAX_SAFE_INTEGER, isAllWhenEmptyPrefix = false) { | ||
prefix = this._caseProcess(prefix); | ||
@@ -258,3 +259,3 @@ const words = []; | ||
} | ||
if (startNode !== this.root) | ||
if (isAllWhenEmptyPrefix || startNode !== this.root) | ||
dfs(startNode, prefix); | ||
@@ -261,0 +262,0 @@ return words; |
{ | ||
"name": "min-heap-typed", | ||
"version": "1.38.8", | ||
"version": "1.38.9", | ||
"description": "Min Heap. Javascript & Typescript Data Structure.", | ||
@@ -134,4 +134,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"data-structure-typed": "^1.38.8" | ||
"data-structure-typed": "^1.38.9" | ||
} | ||
} |
@@ -118,3 +118,4 @@ /** | ||
*/ | ||
export class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNode<V, BinaryTreeNodeNested<V>>> implements IBinaryTree<V, N> { | ||
export class BinaryTree<V = any, N extends BinaryTreeNode<V, N> = BinaryTreeNode<V, BinaryTreeNodeNested<V>>> | ||
implements IBinaryTree<V, N> { | ||
/** | ||
@@ -978,3 +979,2 @@ * Creates a new instance of BinaryTree. | ||
} | ||
} | ||
@@ -981,0 +981,0 @@ } |
@@ -27,3 +27,5 @@ /** | ||
export class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNested<V>>> extends BinaryTree<V, N> implements IBinaryTree<V, N> { | ||
export class BST<V = any, N extends BSTNode<V, N> = BSTNode<V, BSTNodeNested<V>>> | ||
extends BinaryTree<V, N> | ||
implements IBinaryTree<V, N> { | ||
/** | ||
@@ -30,0 +32,0 @@ * The constructor function initializes a binary search tree object with an optional comparator |
@@ -22,3 +22,5 @@ import {BinaryTreeNodeKey, RBColor, RBTreeNodeNested, RBTreeOptions} from '../../types'; | ||
export class RBTree<V, N extends RBTreeNode<V, N> = RBTreeNode<V, RBTreeNodeNested<V>>> extends BST<V, N> implements IBinaryTree<V, N> { | ||
export class RBTree<V, N extends RBTreeNode<V, N> = RBTreeNode<V, RBTreeNodeNested<V>>> | ||
extends BST<V, N> | ||
implements IBinaryTree<V, N> { | ||
constructor(options?: RBTreeOptions) { | ||
@@ -25,0 +27,0 @@ super(options); |
@@ -244,5 +244,6 @@ /** | ||
* @param {number} max - The max count of words will be found | ||
* @param isAllWhenEmptyPrefix - If true, when the prefix provided as '', returns all the words in the trie. | ||
* @returns {string[]} an array of strings. | ||
*/ | ||
getWords(prefix = '', max = Number.MAX_SAFE_INTEGER): string[] { | ||
getWords(prefix = '', max = Number.MAX_SAFE_INTEGER, isAllWhenEmptyPrefix = false): string[] { | ||
prefix = this._caseProcess(prefix); | ||
@@ -274,4 +275,5 @@ const words: string[] = []; | ||
} | ||
if (startNode !== this.root) dfs(startNode, prefix); | ||
if (isAllWhenEmptyPrefix || startNode !== this.root) dfs(startNode, prefix); | ||
return words; | ||
@@ -278,0 +280,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1258564
24900
Updateddata-structure-typed@^1.38.9