diff --git a/CHANGELOG.md b/CHANGELOG.md index eb6646d..f1dd951 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ All notable changes to this project will be documented in this file. - [Semantic Versioning](https://semver.org/spec/v2.0.0.html) - [`auto-changelog`](https://github.com/CookPete/auto-changelog) -## [v1.37.3](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming) +## [v1.38.4](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming) ### Changes diff --git a/README.md b/README.md index 169fefd..b6a6055 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ import { ```html - + ``` ```js diff --git a/package-lock.json b/package-lock.json index c4f24c4..01deb13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "data-structure-typed", - "version": "1.38.2", + "version": "1.38.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "data-structure-typed", - "version": "1.38.2", + "version": "1.38.4", "license": "MIT", "devDependencies": { "@types/benchmark": "^2.1.3", @@ -15,10 +15,10 @@ "@typescript-eslint/eslint-plugin": "^6.7.4", "@typescript-eslint/parser": "^6.7.4", "auto-changelog": "^2.4.0", - "avl-tree-typed": "^1.38.2", + "avl-tree-typed": "^1.38.3", "benchmark": "^2.1.4", - "binary-tree-typed": "^1.38.2", - "bst-typed": "^1.38.2", + "binary-tree-typed": "^1.38.3", + "bst-typed": "^1.38.3", "dependency-cruiser": "^14.1.0", "eslint": "^8.50.0", "eslint-config-prettier": "^9.0.0", @@ -2728,9 +2728,9 @@ } }, "node_modules/avl-tree-typed": { - "version": "1.38.2", - "resolved": "https://registry.npmjs.org/avl-tree-typed/-/avl-tree-typed-1.38.2.tgz", - "integrity": "sha512-2P1DPzdnTuvENa6bGA7vqglC+Ae8GndRSX4H5JeB4V5ZVoiWFpSDL2lO4kRJJYbceL+hemx4Ge/MriGYKgXIfQ==", + "version": "1.38.3", + "resolved": "https://registry.npmjs.org/avl-tree-typed/-/avl-tree-typed-1.38.3.tgz", + "integrity": "sha512-ecoSXprvLtWQlq3Cgp4HNeSeWQgruHyjePxZ8+2ldeUhNN0xgI4Bm8yv/GbN7wV6WGG3V85EidBnu9skZ7jDUA==", "dev": true }, "node_modules/babel-jest": { @@ -2924,9 +2924,9 @@ } }, "node_modules/binary-tree-typed": { - "version": "1.38.2", - "resolved": "https://registry.npmjs.org/binary-tree-typed/-/binary-tree-typed-1.38.2.tgz", - "integrity": "sha512-odemWypyURZVq3qdegpaQDFydmt3sZA3uLHbcav3bBbnPj9WuMSIbOeOs21Nrj/yJHk1GrmlFRbPjYrrDXfdaw==", + "version": "1.38.3", + "resolved": "https://registry.npmjs.org/binary-tree-typed/-/binary-tree-typed-1.38.3.tgz", + "integrity": "sha512-fMnVgcByTNPM3D5sGJOQJ7/N3BUPqiMju4uTb7vDuGFC/sOcM1yN2MzbCEg/Ewwz7AQ7fydC2icuvqyY/AEUWA==", "dev": true }, "node_modules/brace-expansion": { @@ -3005,9 +3005,9 @@ } }, "node_modules/bst-typed": { - "version": "1.38.2", - "resolved": "https://registry.npmjs.org/bst-typed/-/bst-typed-1.38.2.tgz", - "integrity": "sha512-BcTSvIbi8m5kEqzlS++YYlg2IgKhuqsX1mu200BLGq4d327vsQq9hY8TneuL54N4KAr4McR2GqpkDaHXQ3eTbw==", + "version": "1.38.3", + "resolved": "https://registry.npmjs.org/bst-typed/-/bst-typed-1.38.3.tgz", + "integrity": "sha512-T83xkJXfuTjh0wGLiabSqmje4Ky5VxAfYA0RcM4UcgM7lFsYvyGwuSaI9AEWYbr+8Tb2sKqQ8uNP45mF+rB9Lg==", "dev": true }, "node_modules/buffer-from": { diff --git a/package.json b/package.json index b0a5357..3616ea3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "data-structure-typed", - "version": "1.38.3", + "version": "1.38.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.", "main": "dist/cjs/index.js", "module": "dist/mjs/index.js", @@ -39,7 +39,7 @@ "copy:to-subs": "sh scripts/copy_to_all_subs.sh", "publish:subs": "npm run copy:to-subs && sh scripts/publish_all_subs.sh", "publish:docs": "sh scripts/publish_docs.sh", - "publish:all": "npm run ci && npm publish && npm run publish:subs && npm run publish:docs" + "publish:all": "npm run ci && npm publish && npm run publish:docs && npm run publish:subs" }, "repository": { "type": "git", @@ -61,10 +61,10 @@ "@typescript-eslint/eslint-plugin": "^6.7.4", "@typescript-eslint/parser": "^6.7.4", "auto-changelog": "^2.4.0", - "avl-tree-typed": "^1.38.2", + "avl-tree-typed": "^1.38.3", "benchmark": "^2.1.4", - "binary-tree-typed": "^1.38.2", - "bst-typed": "^1.38.2", + "binary-tree-typed": "^1.38.3", + "bst-typed": "^1.38.3", "dependency-cruiser": "^14.1.0", "eslint": "^8.50.0", "eslint-config-prettier": "^9.0.0", diff --git a/scripts/publish_all_subs.sh b/scripts/publish_all_subs.sh index 6f52833..7b7da2f 100755 --- a/scripts/publish_all_subs.sh +++ b/scripts/publish_all_subs.sh @@ -61,8 +61,8 @@ for dir in "${directories[@]}"; do # jq ".dependencies[\"data-structure-typed\"] = \"$version_prompted\"" package.json > temp.json # mv temp.json package.json -# # Install data-structure-typed package and build -# npm i data-structure-typed@"$version_prompted" + # Install data-structure-typed package and build + npm i data-structure-typed@"$version_prompted" npm run build:publish cd .. diff --git a/src/data-structures/linked-list/doubly-linked-list.ts b/src/data-structures/linked-list/doubly-linked-list.ts index cbd69d5..972f137 100644 --- a/src/data-structures/linked-list/doubly-linked-list.ts +++ b/src/data-structures/linked-list/doubly-linked-list.ts @@ -266,7 +266,7 @@ export class DoublyLinkedList { * @returns The function `findNodeByValue` returns a `DoublyLinkedListNode` if a node with the specified value `val` * is found in the linked list. If no such node is found, it returns `null`. */ - findNode(val: E): DoublyLinkedListNode | null { + findNode(val: E | null): DoublyLinkedListNode | null { let current = this.head; while (current) { @@ -341,7 +341,7 @@ export class DoublyLinkedList { * @returns The `delete` method returns a boolean value. It returns `true` if the value or node was successfully * deleted from the doubly linked list, and `false` if the value or node was not found in the list. */ - delete(valOrNode: E | DoublyLinkedListNode): boolean { + delete(valOrNode: E | DoublyLinkedListNode | null): boolean { let node: DoublyLinkedListNode | null; if (valOrNode instanceof DoublyLinkedListNode) { @@ -594,8 +594,6 @@ export class DoublyLinkedList { return false; } - insertBefore(existingValueOrNode: E, newValue: E): boolean; - insertBefore(existingValueOrNode: DoublyLinkedListNode, newValue: E): boolean; /** * The `insertBefore` function inserts a new value before an existing value or node in a doubly linked list. diff --git a/src/data-structures/linked-list/singly-linked-list.ts b/src/data-structures/linked-list/singly-linked-list.ts index 2eaca25..c4e1da9 100644 --- a/src/data-structures/linked-list/singly-linked-list.ts +++ b/src/data-structures/linked-list/singly-linked-list.ts @@ -214,9 +214,6 @@ export class SinglyLinkedList { return removedNode!.val; } - delete(valueOrNode: E): boolean; - delete(valueOrNode: SinglyLinkedListNode): boolean; - /** * The delete function removes a node with a specific value from a singly linked list. * @param {E | SinglyLinkedListNode} valueOrNode - The `valueOrNode` parameter can accept either a value of type `E` @@ -224,7 +221,8 @@ export class SinglyLinkedList { * @returns The `delete` method returns a boolean value. It returns `true` if the value or node is found and * successfully deleted from the linked list, and `false` if the value or node is not found in the linked list. */ - delete(valueOrNode: E | SinglyLinkedListNode): boolean { + delete(valueOrNode: E | SinglyLinkedListNode | null | undefined): boolean { + if (!valueOrNode) return false; let value: E; if (valueOrNode instanceof SinglyLinkedListNode) { value = valueOrNode.val; @@ -397,9 +395,6 @@ export class SinglyLinkedList { return null; } - insertBefore(existingValue: E, newValue: E): boolean; - insertBefore(existingValue: SinglyLinkedListNode, newValue: E): boolean; - /** * The `insertBefore` function inserts a new value before an existing value in a singly linked list. * @param {E | SinglyLinkedListNode} existingValueOrNode - The existing value or node that you want to insert the diff --git a/src/types/data-structures/binary-tree/binary-tree.ts b/src/types/data-structures/binary-tree/binary-tree.ts index 80ce0a4..61b63bb 100644 --- a/src/types/data-structures/binary-tree/binary-tree.ts +++ b/src/types/data-structures/binary-tree/binary-tree.ts @@ -1,5 +1,4 @@ import {BinaryTreeNode} from '../../../data-structures'; -import PropertyKeysOf = jest.PropertyKeysOf; /** * Enum representing different loop types. diff --git a/test/integration/index.html b/test/integration/index.html index ab70fa2..0fab945 100644 --- a/test/integration/index.html +++ b/test/integration/index.html @@ -3,7 +3,7 @@ CDN Test - +
@@ -23,7 +23,7 @@ $avlTreeSpan.innerText = 'AVLTree'; $avlTree.append($avlTreeSpan); avlTree.add(1, 1); - console.log(avlTree.BFS()); + console.log(avlTree.bfs()); $modules.append($avlTree);