data-structure-typed 1.38.4 → 1.38.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +12 -3
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +17 -4
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +2 -0
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +12 -3
- package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +17 -4
- package/dist/mjs/data-structures/linked-list/singly-linked-list.js +2 -0
- package/dist/umd/index.global.js +1 -1
- package/dist/umd/index.global.js.map +1 -1
- package/package.json +5 -5
- package/src/data-structures/linked-list/doubly-linked-list.ts +2 -4
- package/src/data-structures/linked-list/singly-linked-list.ts +2 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-structure-typed",
|
|
3
|
-
"version": "1.38.
|
|
3
|
+
"version": "1.38.5",
|
|
4
4
|
"description": "Data Structures of Javascript & TypeScript. Binary Tree, BST, Graph, Heap, Priority Queue, Linked List, Queue, Deque, Stack, AVL Tree, Tree Multiset, Trie, Directed Graph, Undirected Graph, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/mjs/index.js",
|
|
@@ -61,17 +61,17 @@
|
|
|
61
61
|
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
|
62
62
|
"@typescript-eslint/parser": "^6.7.4",
|
|
63
63
|
"auto-changelog": "^2.4.0",
|
|
64
|
-
"avl-tree-typed": "^1.38.
|
|
64
|
+
"avl-tree-typed": "^1.38.4",
|
|
65
65
|
"benchmark": "^2.1.4",
|
|
66
|
-
"binary-tree-typed": "^1.38.
|
|
67
|
-
"bst-typed": "^1.38.
|
|
66
|
+
"binary-tree-typed": "^1.38.4",
|
|
67
|
+
"bst-typed": "^1.38.4",
|
|
68
68
|
"dependency-cruiser": "^14.1.0",
|
|
69
69
|
"eslint": "^8.50.0",
|
|
70
70
|
"eslint-config-prettier": "^9.0.0",
|
|
71
71
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
72
72
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
73
73
|
"eslint-plugin-import": "^2.28.1",
|
|
74
|
-
"heap-typed": "^1.38.
|
|
74
|
+
"heap-typed": "^1.38.4",
|
|
75
75
|
"istanbul-badges-readme": "^1.8.5",
|
|
76
76
|
"jest": "^29.7.0",
|
|
77
77
|
"prettier": "^3.0.3",
|
|
@@ -266,7 +266,7 @@ export class DoublyLinkedList<E = any> {
|
|
|
266
266
|
* @returns The function `findNodeByValue` returns a `DoublyLinkedListNode<E>` if a node with the specified value `val`
|
|
267
267
|
* is found in the linked list. If no such node is found, it returns `null`.
|
|
268
268
|
*/
|
|
269
|
-
findNode(val: E): DoublyLinkedListNode<E> | null {
|
|
269
|
+
findNode(val: E | null): DoublyLinkedListNode<E> | null {
|
|
270
270
|
let current = this.head;
|
|
271
271
|
|
|
272
272
|
while (current) {
|
|
@@ -341,7 +341,7 @@ export class DoublyLinkedList<E = any> {
|
|
|
341
341
|
* @returns The `delete` method returns a boolean value. It returns `true` if the value or node was successfully
|
|
342
342
|
* deleted from the doubly linked list, and `false` if the value or node was not found in the list.
|
|
343
343
|
*/
|
|
344
|
-
delete(valOrNode: E | DoublyLinkedListNode<E>): boolean {
|
|
344
|
+
delete(valOrNode: E | DoublyLinkedListNode<E> | null): boolean {
|
|
345
345
|
let node: DoublyLinkedListNode<E> | null;
|
|
346
346
|
|
|
347
347
|
if (valOrNode instanceof DoublyLinkedListNode) {
|
|
@@ -594,8 +594,6 @@ export class DoublyLinkedList<E = any> {
|
|
|
594
594
|
return false;
|
|
595
595
|
}
|
|
596
596
|
|
|
597
|
-
insertBefore(existingValueOrNode: E, newValue: E): boolean;
|
|
598
|
-
insertBefore(existingValueOrNode: DoublyLinkedListNode<E>, newValue: E): boolean;
|
|
599
597
|
|
|
600
598
|
/**
|
|
601
599
|
* The `insertBefore` function inserts a new value before an existing value or node in a doubly linked list.
|
|
@@ -214,9 +214,6 @@ export class SinglyLinkedList<E = any> {
|
|
|
214
214
|
return removedNode!.val;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
delete(valueOrNode: E): boolean;
|
|
218
|
-
delete(valueOrNode: SinglyLinkedListNode<E>): boolean;
|
|
219
|
-
|
|
220
217
|
/**
|
|
221
218
|
* The delete function removes a node with a specific value from a singly linked list.
|
|
222
219
|
* @param {E | SinglyLinkedListNode<E>} valueOrNode - The `valueOrNode` parameter can accept either a value of type `E`
|
|
@@ -224,7 +221,8 @@ export class SinglyLinkedList<E = any> {
|
|
|
224
221
|
* @returns The `delete` method returns a boolean value. It returns `true` if the value or node is found and
|
|
225
222
|
* successfully deleted from the linked list, and `false` if the value or node is not found in the linked list.
|
|
226
223
|
*/
|
|
227
|
-
delete(valueOrNode: E | SinglyLinkedListNode<E>): boolean {
|
|
224
|
+
delete(valueOrNode: E | SinglyLinkedListNode<E> | null | undefined): boolean {
|
|
225
|
+
if (!valueOrNode) return false;
|
|
228
226
|
let value: E;
|
|
229
227
|
if (valueOrNode instanceof SinglyLinkedListNode) {
|
|
230
228
|
value = valueOrNode.val;
|
|
@@ -397,9 +395,6 @@ export class SinglyLinkedList<E = any> {
|
|
|
397
395
|
return null;
|
|
398
396
|
}
|
|
399
397
|
|
|
400
|
-
insertBefore(existingValue: E, newValue: E): boolean;
|
|
401
|
-
insertBefore(existingValue: SinglyLinkedListNode<E>, newValue: E): boolean;
|
|
402
|
-
|
|
403
398
|
/**
|
|
404
399
|
* The `insertBefore` function inserts a new value before an existing value in a singly linked list.
|
|
405
400
|
* @param {E | SinglyLinkedListNode<E>} existingValueOrNode - The existing value or node that you want to insert the
|