jc-structure 0.1.10 → 0.1.11
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/index.d.ts +12 -10
- package/package.json +1 -1
- package/types/global.d.ts +7 -1
- package/types/heap.d.ts +4 -3
- package/types/queue.d.ts +1 -1
- package/types/stack.d.ts +2 -4
package/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/// <reference path='./global.d.ts' />
|
|
2
|
+
/// <reference path='./types/stack.d.ts' />
|
|
3
|
+
/// <reference path='./types/queue.d.ts' />
|
|
4
|
+
/// <reference path='./types/heap.d.ts' />
|
|
5
|
+
|
|
1
6
|
declare module "jc-structure" {
|
|
2
|
-
import type { IStack } from "./types/stack";
|
|
3
|
-
import type { IQueue } from "./types/queue";
|
|
4
|
-
import type { IHeap } from "./types/heap";
|
|
5
7
|
/**
|
|
6
8
|
* 栈类,采用object实现
|
|
7
9
|
*/
|
|
@@ -22,15 +24,15 @@ declare module "jc-structure" {
|
|
|
22
24
|
}
|
|
23
25
|
declare const Queue: QueueConstructor;
|
|
24
26
|
|
|
25
|
-
type CompareResult = -1 | 0 | 1;
|
|
27
|
+
// type CompareResult = -1 | 0 | 1;
|
|
26
28
|
|
|
27
|
-
interface CompareFn<T> {
|
|
28
|
-
|
|
29
|
-
}
|
|
29
|
+
// interface CompareFn<T> {
|
|
30
|
+
// (a: T, b: T): CompareResult;
|
|
31
|
+
// }
|
|
30
32
|
|
|
31
|
-
interface Obj<V = any> {
|
|
32
|
-
|
|
33
|
-
}
|
|
33
|
+
// interface Obj<V = any> {
|
|
34
|
+
// [key: string]: V;
|
|
35
|
+
// }
|
|
34
36
|
/**
|
|
35
37
|
* 最小堆
|
|
36
38
|
*/
|
package/package.json
CHANGED
package/types/global.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
interface Structure {
|
|
2
2
|
/**
|
|
3
3
|
* 判断数据结构是否为空
|
|
4
4
|
*/
|
|
@@ -19,10 +19,16 @@ export declare interface Structure {
|
|
|
19
19
|
|
|
20
20
|
type CompareResult = -1 | 0 | 1;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* #### 比较函数接口
|
|
24
|
+
*/
|
|
22
25
|
interface CompareFn<T> {
|
|
23
26
|
(a: T, b: T): CompareResult;
|
|
24
27
|
}
|
|
25
28
|
|
|
29
|
+
/**
|
|
30
|
+
* #### 对象接口,用于存储数据结构元素,值类型默认为 any
|
|
31
|
+
*/
|
|
26
32
|
interface Obj<V = any> {
|
|
27
33
|
[key: string]: V;
|
|
28
34
|
}
|
package/types/heap.d.ts
CHANGED
package/types/queue.d.ts
CHANGED
package/types/stack.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface StructureObj<T> {
|
|
1
|
+
interface StructureObj<T> {
|
|
4
2
|
[key: number]: T;
|
|
5
3
|
}
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* #### 栈接口
|
|
9
7
|
*/
|
|
10
|
-
|
|
8
|
+
interface IStack<T> extends Structure {
|
|
11
9
|
/**
|
|
12
10
|
* #### 移除栈顶元素并返回该元素
|
|
13
11
|
*/
|