@chanyuxi/utils 0.1.4 → 0.1.6
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/dist/data-structure.d.ts +23 -0
- package/dist/data-structure.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/package.json +7 -3
- package/dist/types/data-structure/queue.d.ts +0 -14
- package/dist/types/index.d.ts +0 -1
@@ -0,0 +1,23 @@
|
|
1
|
+
export interface ITreeNode<T> {
|
2
|
+
value: T;
|
3
|
+
}
|
4
|
+
|
5
|
+
export class BinaryTreeNode<T> implements ITreeNode<T> {
|
6
|
+
value: T;
|
7
|
+
l: BinaryTreeNode<T> | null;
|
8
|
+
r: BinaryTreeNode<T> | null;
|
9
|
+
}
|
10
|
+
|
11
|
+
export class Queue<T> {
|
12
|
+
peek(): T | null;
|
13
|
+
pop(): T | null;
|
14
|
+
push(value: T): void;
|
15
|
+
size(): number;
|
16
|
+
}
|
17
|
+
|
18
|
+
export class Stack<T> {
|
19
|
+
peek(): T | null;
|
20
|
+
pop(): T | null;
|
21
|
+
push(value: T): void;
|
22
|
+
size(): number;
|
23
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
class Queue{constructor(){this.data=[]}peek(){var t;return null!==(t=this.data[0])&&void 0!==t?t:null}pop(){var t;return null!==(t=this.data.shift())&&void 0!==t?t:null}push(t){this.data.push(t)}size(){return this.data.length}}export{Queue};
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./data-structure";
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
export{Queue}from"./data-structure.js";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@chanyuxi/utils",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.6",
|
4
4
|
"author": "Chan-Yuxi <2438149743@qq.com> (https://github.com/Chan-Yuxi)",
|
5
5
|
"license": "ISC",
|
6
6
|
"description": "Collection of practical tools for personal use",
|
@@ -16,22 +16,26 @@
|
|
16
16
|
"publishConfig": {
|
17
17
|
"access": "public"
|
18
18
|
},
|
19
|
+
"types": "./dist/index.d.ts",
|
19
20
|
"files": [
|
20
21
|
"dist"
|
21
22
|
],
|
22
23
|
"type": "module",
|
23
24
|
"main": "./dist/index.js",
|
24
25
|
"exports": {
|
25
|
-
".": "./dist/index.js"
|
26
|
+
".": "./dist/index.js",
|
27
|
+
"./data-structure": "./dist/data-structure.js",
|
28
|
+
"./data-structure.js": "./dist/data-structure.js"
|
26
29
|
},
|
27
30
|
"scripts": {
|
28
|
-
"build": "rollup -c",
|
31
|
+
"build": "rollup -c rollup.config.ts --configPlugin typescript",
|
29
32
|
"test": "mocha"
|
30
33
|
},
|
31
34
|
"devDependencies": {
|
32
35
|
"@rollup/plugin-terser": "^0.4.4",
|
33
36
|
"@rollup/plugin-typescript": "^12.1.2",
|
34
37
|
"@tsconfig/recommended": "^1.0.8",
|
38
|
+
"@types/node": "^22.13.5",
|
35
39
|
"mocha": "^11.1.0",
|
36
40
|
"prettier": "3.5.2",
|
37
41
|
"rollup": "^4.34.8",
|
@@ -1,14 +0,0 @@
|
|
1
|
-
interface IQueue<T> {
|
2
|
-
peek(): T | null;
|
3
|
-
pop(): T | null;
|
4
|
-
push(value: T): void;
|
5
|
-
size(): number;
|
6
|
-
}
|
7
|
-
export declare class Queue<T> implements IQueue<T> {
|
8
|
-
private data;
|
9
|
-
peek(): T;
|
10
|
-
pop(): T | null;
|
11
|
-
push(value: T): void;
|
12
|
-
size(): number;
|
13
|
-
}
|
14
|
-
export {};
|
package/dist/types/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from "./data-structure/queue";
|