data-structure-typed 2.2.6 → 2.2.7
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/CONTRIBUTING.md +47 -1
- package/README.md +6 -6
- package/dist/cjs/index.cjs +3 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +3 -0
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +3 -0
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/umd/data-structure-typed.js +3 -0
- package/dist/umd/data-structure-typed.js.map +1 -1
- package/dist/umd/data-structure-typed.min.js +2 -2
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/tsup.config.js +2 -2
- package/tsup.leetcode.config.js +1 -1
- package/tsup.node.config.js +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,7 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
9
9
|
- [`auto-changelog`](https://github.com/CookPete/auto-changelog)
|
|
10
10
|
|
|
11
|
-
## [v2.2.
|
|
11
|
+
## [v2.2.7](https://github.com/zrwusa/data-structure-typed/compare/v2.2.3...main) (upcoming)
|
|
12
12
|
|
|
13
13
|
## [v2.2.3](https://github.com/zrwusa/data-structure-typed/compare/v2.2.2...v2.2.3) (6 January 2026)
|
|
14
14
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -83,9 +83,55 @@
|
|
|
83
83
|
- click the `New pull request` on Github https://github.com/zrwusa/data-structure-typed/branches
|
|
84
84
|
|
|
85
85
|
**performance inspection**
|
|
86
|
-
- `node --inspect-brk
|
|
86
|
+
- `node --inspect-brk perf/hello-world.js`
|
|
87
87
|
- chrome://inspect/#devices -> Open dedicated DevTools for Node
|
|
88
88
|
|
|
89
|
+
|
|
90
|
+
**node:perf_hooks**
|
|
91
|
+
```javascript
|
|
92
|
+
const { performance } = require('node:perf_hooks');
|
|
93
|
+
|
|
94
|
+
// Force garbage collection (run with --expose-gc flag)
|
|
95
|
+
const forceGC = () => {
|
|
96
|
+
if (global.gc) {
|
|
97
|
+
global.gc();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Test Queue
|
|
102
|
+
function testQueue(QUANTITY) {
|
|
103
|
+
forceGC();
|
|
104
|
+
const initialMemory = process.memoryUsage().heapUsed;
|
|
105
|
+
|
|
106
|
+
const queue = new Queue();
|
|
107
|
+
const start = performance.now();
|
|
108
|
+
|
|
109
|
+
for (let i = 0; i < QUANTITY; i++) {
|
|
110
|
+
queue.push(i);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const end = performance.now();
|
|
114
|
+
const finalMemory = process.memoryUsage().heapUsed;
|
|
115
|
+
const memoryDelta = formatMemory(finalMemory - initialMemory);
|
|
116
|
+
|
|
117
|
+
console.log(`Queue push ${QUANTITY} elements: ${(end - start).toFixed(2)}ms`);
|
|
118
|
+
console.log(`Memory usage: ${memoryDelta}${CURRENT_UNIT} (growth)`);
|
|
119
|
+
|
|
120
|
+
return queue;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
testDeque(1000000);
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```shell
|
|
128
|
+
node --expose-gc benchmark/deque.js
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**performance info output**
|
|
132
|
+
-`node --prof perf/hello-world.js`
|
|
133
|
+
-`node --prof-process isolate-*.log > prof.txt`
|
|
134
|
+
|
|
89
135
|
**Contributing New Data Structures**
|
|
90
136
|
|
|
91
137
|
- Make your pull requests to be **specific** and **focused**. Instead of
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A comprehensive TypeScript data structures library with production-ready implementations.
|
|
4
4
|
|
|
5
|
-
**📚 [Quick Start](#-quick-start-30-seconds) • [
|
|
5
|
+
**📚 [Installation](#-installation) • [Quick Start](#-quick-start-30-seconds) • [Full Docs](./docs/CONCEPTS.md) • [API Reference](./docs/REFERENCE.md) • [Playground](#playground) • [Examples](./docs/GUIDES.md)**
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -484,14 +484,14 @@ const tree = new RedBlackTree([5, 2, 8]);
|
|
|
484
484
|
console.log([...tree]); // [2, 5, 8] - Automatically sorted!
|
|
485
485
|
```
|
|
486
486
|
|
|
487
|
-
##
|
|
487
|
+
## Playground
|
|
488
488
|
|
|
489
|
-
Try it instantly:
|
|
489
|
+
🏃🏻♀️ Try it instantly:
|
|
490
490
|
|
|
491
491
|
- [Node.js TypeScript](https://stackblitz.com/edit/stackblitz-starters-e1vdy3zw?file=src%2Findex.ts)
|
|
492
|
-
- [Node.js JavaScript](https://stackblitz.com/edit/stackblitz-starters-
|
|
493
|
-
- [React TypeScript](https://stackblitz.com/edit/vitejs-vite-
|
|
494
|
-
- [NestJS](https://stackblitz.com/edit/nestjs-typescript-starter-
|
|
492
|
+
- [Node.js JavaScript](https://stackblitz.com/edit/stackblitz-starters-oczhrfzn?file=src%2Findex.js)
|
|
493
|
+
- [React TypeScript](https://stackblitz.com/edit/vitejs-vite-7bva1zhd?file=src%2FApp.tsx)
|
|
494
|
+
- [NestJS](https://stackblitz.com/edit/nestjs-typescript-starter-q9n7okgc?file=src%2Fproduct%2Fservices%2Fproduct-price-index.service.ts)
|
|
495
495
|
|
|
496
496
|
|
|
497
497
|
### Step 4: Learn More
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -181,6 +181,7 @@ var IterableEntryBase = class {
|
|
|
181
181
|
* @remarks Time O(n), Space O(n)
|
|
182
182
|
*/
|
|
183
183
|
print() {
|
|
184
|
+
console.log(this.toVisual());
|
|
184
185
|
}
|
|
185
186
|
};
|
|
186
187
|
|
|
@@ -403,6 +404,7 @@ var IterableElementBase = class {
|
|
|
403
404
|
* Time O(n) due to materialization, Space O(n) for the intermediate representation.
|
|
404
405
|
*/
|
|
405
406
|
print() {
|
|
407
|
+
console.log(this.toVisual());
|
|
406
408
|
}
|
|
407
409
|
};
|
|
408
410
|
|
|
@@ -8079,6 +8081,7 @@ var BinaryTree = class extends IterableEntryBase {
|
|
|
8079
8081
|
* @param [startNode=this._root] - The node to start printing from.
|
|
8080
8082
|
*/
|
|
8081
8083
|
print(options, startNode = this._root) {
|
|
8084
|
+
console.log(this.toVisual(startNode, options));
|
|
8082
8085
|
}
|
|
8083
8086
|
/**
|
|
8084
8087
|
* (Protected) Core DFS implementation.
|