@aitianyu.cn/types 0.0.13 → 0.1.1
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/lib/{utilities/coding → coding}/Error.js +44 -44
- package/dist/lib/{utilities/coding → coding}/Path.js +210 -198
- package/dist/lib/{utilities/core → core}/Errors.js +86 -86
- package/dist/lib/{utilities/core → core}/Language.js +561 -559
- package/dist/lib/{utilities/core → core}/Log.js +112 -108
- package/dist/lib/{utilities/core → core}/TypeConvertion.js +25 -25
- package/dist/lib/{utilities/core → core}/interface/ITJSON.js +3 -3
- package/dist/lib/{utilities/core → core}/interface/ITianyuType.js +3 -3
- package/dist/lib/{utilities/core → core}/object/ArrayHelper.js +35 -35
- package/dist/lib/core/object/Bytes.js +21 -0
- package/dist/lib/{utilities/core → core}/object/Calculater.js +240 -230
- package/dist/lib/core/object/DataView.js +23 -0
- package/dist/lib/core/object/Integer.js +117 -0
- package/dist/lib/core/object/Json.js +35 -0
- package/dist/lib/{utilities/core/object/Helper.js → core/object/ObjectHelper.js} +202 -201
- package/dist/lib/core/object/StringHelper.js +61 -0
- package/dist/lib/{utilities/core → core}/type/TArray.js +8 -7
- package/dist/lib/{utilities/core → core}/type/TBoolean.js +7 -7
- package/dist/lib/{utilities/core → core}/type/TJSON.js +7 -7
- package/dist/lib/{utilities/core → core}/type/TNumber.js +7 -7
- package/dist/lib/{utilities/core → core}/type/TObject.js +7 -7
- package/dist/lib/{utilities/core → core}/type/TString.js +7 -7
- package/dist/lib/index.js +72 -54
- package/dist/lib/security/Base32.js +104 -0
- package/dist/lib/security/Guid.js +26 -0
- package/dist/lib/{utilities/security → security}/Hash.js +16 -15
- package/dist/lib/security/QRCode.js +46 -0
- package/dist/lib/security/RSA.js +62 -0
- package/dist/lib/security/SHA.js +67 -0
- package/dist/lib/security/TOTP.js +55 -0
- package/dist/lib/types/AreaCode.js +269 -269
- package/dist/lib/types/Exception.js +19 -19
- package/dist/lib/types/Logs.js +20 -20
- package/dist/lib/types/Object.js +3 -3
- package/dist/lib/types/PathBase.js +109 -109
- package/dist/lib/types/Security.js +10 -10
- package/dist/lib/types/TMap.js +139 -138
- package/dist/lib/types/Types.js +3 -3
- package/dist/lib/types/index.js +17 -17
- package/dist/types/{utilities/coding → coding}/Error.d.ts +27 -27
- package/dist/types/{utilities/coding → coding}/Path.d.ts +61 -61
- package/dist/types/{utilities/core → core}/Errors.d.ts +47 -47
- package/dist/types/{utilities/core → core}/Language.d.ts +17 -17
- package/dist/types/{utilities/core → core}/Log.d.ts +12 -12
- package/dist/types/{utilities/core → core}/TypeConvertion.d.ts +2 -2
- package/dist/types/{utilities/core → core}/interface/ITJSON.d.ts +5 -5
- package/dist/types/{utilities/core → core}/interface/ITianyuType.d.ts +5 -5
- package/dist/types/{utilities/core → core}/object/ArrayHelper.d.ts +11 -11
- package/dist/types/core/object/Bytes.d.ts +13 -0
- package/dist/types/{utilities/core → core}/object/Calculater.d.ts +22 -22
- package/dist/types/core/object/DataView.d.ts +11 -0
- package/dist/types/core/object/Integer.d.ts +71 -0
- package/dist/types/core/object/Json.d.ts +22 -0
- package/dist/types/{utilities/core/object/Helper.d.ts → core/object/ObjectHelper.d.ts} +39 -39
- package/dist/types/core/object/StringHelper.d.ts +21 -0
- package/dist/types/{utilities/core → core}/type/TArray.d.ts +3 -3
- package/dist/types/{utilities/core → core}/type/TBoolean.d.ts +3 -3
- package/dist/types/{utilities/core → core}/type/TJSON.d.ts +3 -3
- package/dist/types/{utilities/core → core}/type/TNumber.d.ts +3 -3
- package/dist/types/{utilities/core → core}/type/TObject.d.ts +3 -3
- package/dist/types/{utilities/core → core}/type/TString.d.ts +3 -3
- package/dist/types/index.d.ts +30 -21
- package/dist/types/security/Base32.d.ts +42 -0
- package/dist/types/security/Guid.d.ts +4 -0
- package/dist/types/{utilities/security → security}/Hash.d.ts +3 -3
- package/dist/types/security/QRCode.d.ts +11 -0
- package/dist/types/security/RSA.d.ts +68 -0
- package/dist/types/security/SHA.d.ts +40 -0
- package/dist/types/security/TOTP.d.ts +27 -0
- package/dist/types/types/AreaCode.d.ts +135 -135
- package/dist/types/types/Exception.d.ts +11 -11
- package/dist/types/types/Logs.d.ts +64 -64
- package/dist/types/types/Object.d.ts +18 -18
- package/dist/types/types/PathBase.d.ts +76 -76
- package/dist/types/types/Security.d.ts +23 -23
- package/dist/types/types/TMap.d.ts +80 -80
- package/dist/types/types/Types.d.ts +25 -25
- package/dist/types/types/index.d.ts +9 -9
- package/package.json +57 -51
- package/dist/lib/utilities/coding/index.js +0 -10
- package/dist/lib/utilities/core/index.js +0 -21
- package/dist/lib/utilities/core/object/StringHelper.js +0 -22
- package/dist/lib/utilities/security/Guid.js +0 -20
- package/dist/lib/utilities/security/index.js +0 -8
- package/dist/types/utilities/coding/index.d.ts +0 -3
- package/dist/types/utilities/core/index.d.ts +0 -6
- package/dist/types/utilities/core/object/StringHelper.d.ts +0 -4
- package/dist/types/utilities/security/Guid.d.ts +0 -3
- package/dist/types/utilities/security/index.d.ts +0 -3
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
import { PathBase } from "
|
|
3
|
-
import { IComparable } from "
|
|
4
|
-
/** The target path type */
|
|
5
|
-
export type PathTargetType = "directory" | "file";
|
|
6
|
-
/** Path */
|
|
7
|
-
export declare class Path extends PathBase implements IComparable {
|
|
8
|
-
private _type;
|
|
9
|
-
private _file?;
|
|
10
|
-
/**
|
|
11
|
-
* Create a new Path instance
|
|
12
|
-
*
|
|
13
|
-
* @param dirs the directory names
|
|
14
|
-
* @param type indicate which type the Path is
|
|
15
|
-
* @param file the file name if the type is file
|
|
16
|
-
*/
|
|
17
|
-
constructor(dirs?: string[] | string, type?: PathTargetType, file?: string);
|
|
18
|
-
/**
|
|
19
|
-
* Convert the path to a string
|
|
20
|
-
*
|
|
21
|
-
* @returns return the string
|
|
22
|
-
*/
|
|
23
|
-
toString(): string;
|
|
24
|
-
/**
|
|
25
|
-
* Set the target type
|
|
26
|
-
*
|
|
27
|
-
* @param type new type
|
|
28
|
-
*/
|
|
29
|
-
setType(type: PathTargetType): void;
|
|
30
|
-
/**
|
|
31
|
-
* Get the path type of current instance
|
|
32
|
-
*
|
|
33
|
-
* @returns return the path type
|
|
34
|
-
*/
|
|
35
|
-
getType(): PathTargetType;
|
|
36
|
-
/**
|
|
37
|
-
* Set the path file name
|
|
38
|
-
*
|
|
39
|
-
* @param file the new file name
|
|
40
|
-
* @returns return the old file name
|
|
41
|
-
*/
|
|
42
|
-
setFile(file: string): string | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Get the file name of current instance
|
|
45
|
-
*
|
|
46
|
-
* @returns return the file name
|
|
47
|
-
*/
|
|
48
|
-
getFile(): string | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* IComparable impl to get a string what equals to current instance
|
|
51
|
-
*
|
|
52
|
-
* @returns return the string
|
|
53
|
-
*/
|
|
54
|
-
getString(): string;
|
|
55
|
-
/**
|
|
56
|
-
* Get a hash code of current instance
|
|
57
|
-
*
|
|
58
|
-
* @returns always return 0
|
|
59
|
-
*/
|
|
60
|
-
getHashCode(): number;
|
|
61
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
import { PathBase } from "../types/PathBase";
|
|
3
|
+
import { IComparable } from "../types/Types";
|
|
4
|
+
/** The target path type */
|
|
5
|
+
export type PathTargetType = "directory" | "file";
|
|
6
|
+
/** Path */
|
|
7
|
+
export declare class Path extends PathBase implements IComparable {
|
|
8
|
+
private _type;
|
|
9
|
+
private _file?;
|
|
10
|
+
/**
|
|
11
|
+
* Create a new Path instance
|
|
12
|
+
*
|
|
13
|
+
* @param dirs the directory names
|
|
14
|
+
* @param type indicate which type the Path is
|
|
15
|
+
* @param file the file name if the type is file
|
|
16
|
+
*/
|
|
17
|
+
constructor(dirs?: string[] | string, type?: PathTargetType, file?: string);
|
|
18
|
+
/**
|
|
19
|
+
* Convert the path to a string
|
|
20
|
+
*
|
|
21
|
+
* @returns return the string
|
|
22
|
+
*/
|
|
23
|
+
toString(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Set the target type
|
|
26
|
+
*
|
|
27
|
+
* @param type new type
|
|
28
|
+
*/
|
|
29
|
+
setType(type: PathTargetType): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get the path type of current instance
|
|
32
|
+
*
|
|
33
|
+
* @returns return the path type
|
|
34
|
+
*/
|
|
35
|
+
getType(): PathTargetType;
|
|
36
|
+
/**
|
|
37
|
+
* Set the path file name
|
|
38
|
+
*
|
|
39
|
+
* @param file the new file name
|
|
40
|
+
* @returns return the old file name
|
|
41
|
+
*/
|
|
42
|
+
setFile(file: string): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Get the file name of current instance
|
|
45
|
+
*
|
|
46
|
+
* @returns return the file name
|
|
47
|
+
*/
|
|
48
|
+
getFile(): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* IComparable impl to get a string what equals to current instance
|
|
51
|
+
*
|
|
52
|
+
* @returns return the string
|
|
53
|
+
*/
|
|
54
|
+
getString(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Get a hash code of current instance
|
|
57
|
+
*
|
|
58
|
+
* @returns always return 0
|
|
59
|
+
*/
|
|
60
|
+
getHashCode(): number;
|
|
61
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
import { Exception } from "
|
|
3
|
-
/** Argument null exception */
|
|
4
|
-
export declare class ArgumentNullOrEmptyException extends Exception {
|
|
5
|
-
constructor(msg: string);
|
|
6
|
-
toString(): string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Object Clone:
|
|
10
|
-
* Function type is not supported.
|
|
11
|
-
* Exception will be thrown if try to clone a function type object
|
|
12
|
-
*/
|
|
13
|
-
export declare class ObjectCloneFunctionNotSupportException extends Exception {
|
|
14
|
-
constructor();
|
|
15
|
-
toString(): string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Object Clone:
|
|
19
|
-
* Object different status could not be matched.
|
|
20
|
-
* Exception will be thrown if the object diff could not to be merged
|
|
21
|
-
*/
|
|
22
|
-
export declare class ObjectMergeStatusCheckFailedException extends Exception {
|
|
23
|
-
private status;
|
|
24
|
-
private path;
|
|
25
|
-
constructor(path: string, status: "add" | "modify" | "del");
|
|
26
|
-
toString(): string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Object Clone:
|
|
30
|
-
* Object different status could not be applied.
|
|
31
|
-
* Exception will be thrown if the object diff could not to be applied
|
|
32
|
-
*/
|
|
33
|
-
export declare class ObjectDiffApplyInvalidStatusException extends Exception {
|
|
34
|
-
private value;
|
|
35
|
-
constructor(value: any);
|
|
36
|
-
toString(): string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Object Clone:
|
|
40
|
-
* Object different merge failed.
|
|
41
|
-
* Exception will be thrown if the object element could not be accessed
|
|
42
|
-
*/
|
|
43
|
-
export declare class ObjectDiffMergeFailedException extends Exception {
|
|
44
|
-
private path;
|
|
45
|
-
constructor(path: string);
|
|
46
|
-
toString(): string;
|
|
47
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
import { Exception } from "../types/Exception";
|
|
3
|
+
/** Argument null exception */
|
|
4
|
+
export declare class ArgumentNullOrEmptyException extends Exception {
|
|
5
|
+
constructor(msg: string);
|
|
6
|
+
toString(): string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Object Clone:
|
|
10
|
+
* Function type is not supported.
|
|
11
|
+
* Exception will be thrown if try to clone a function type object
|
|
12
|
+
*/
|
|
13
|
+
export declare class ObjectCloneFunctionNotSupportException extends Exception {
|
|
14
|
+
constructor();
|
|
15
|
+
toString(): string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Object Clone:
|
|
19
|
+
* Object different status could not be matched.
|
|
20
|
+
* Exception will be thrown if the object diff could not to be merged
|
|
21
|
+
*/
|
|
22
|
+
export declare class ObjectMergeStatusCheckFailedException extends Exception {
|
|
23
|
+
private status;
|
|
24
|
+
private path;
|
|
25
|
+
constructor(path: string, status: "add" | "modify" | "del");
|
|
26
|
+
toString(): string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Object Clone:
|
|
30
|
+
* Object different status could not be applied.
|
|
31
|
+
* Exception will be thrown if the object diff could not to be applied
|
|
32
|
+
*/
|
|
33
|
+
export declare class ObjectDiffApplyInvalidStatusException extends Exception {
|
|
34
|
+
private value;
|
|
35
|
+
constructor(value: any);
|
|
36
|
+
toString(): string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Object Clone:
|
|
40
|
+
* Object different merge failed.
|
|
41
|
+
* Exception will be thrown if the object element could not be accessed
|
|
42
|
+
*/
|
|
43
|
+
export declare class ObjectDiffMergeFailedException extends Exception {
|
|
44
|
+
private path;
|
|
45
|
+
constructor(path: string);
|
|
46
|
+
toString(): string;
|
|
47
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
import { AreaCode } from "
|
|
3
|
-
/**
|
|
4
|
-
* Parse area code to general string
|
|
5
|
-
*
|
|
6
|
-
* @param eArea the area code
|
|
7
|
-
* @returns return the general string of specified area code
|
|
8
|
-
*/
|
|
9
|
-
export declare function parseAreaCode(eArea: AreaCode): string;
|
|
10
|
-
/**
|
|
11
|
-
* Convert the string to area code
|
|
12
|
-
*
|
|
13
|
-
* @param areaStr the source string
|
|
14
|
-
* @param forceArea a boolean value indicates whether needs to have a strict check for the source string. (That means if in strict mode and the string could not be converted, an unkonwn will be returned.)
|
|
15
|
-
* @returns return the area code
|
|
16
|
-
*/
|
|
17
|
-
export declare function parseAreaString(areaStr?: string, forceArea?: boolean): AreaCode;
|
|
1
|
+
/**@format */
|
|
2
|
+
import { AreaCode } from "../types/AreaCode";
|
|
3
|
+
/**
|
|
4
|
+
* Parse area code to general string
|
|
5
|
+
*
|
|
6
|
+
* @param eArea the area code
|
|
7
|
+
* @returns return the general string of specified area code
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseAreaCode(eArea: AreaCode): string;
|
|
10
|
+
/**
|
|
11
|
+
* Convert the string to area code
|
|
12
|
+
*
|
|
13
|
+
* @param areaStr the source string
|
|
14
|
+
* @param forceArea a boolean value indicates whether needs to have a strict check for the source string. (That means if in strict mode and the string could not be converted, an unkonwn will be returned.)
|
|
15
|
+
* @returns return the area code
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseAreaString(areaStr?: string, forceArea?: boolean): AreaCode;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
import { ILog, IPerfRecorder } from "
|
|
3
|
-
declare function _startPerf(id?: string): IPerfRecorder;
|
|
4
|
-
declare function _endPerf(recorder: IPerfRecorder, console?: boolean): number;
|
|
5
|
-
/** Tianyu Log Instance */
|
|
6
|
-
export declare const Log: ILog;
|
|
7
|
-
/** Tianyu Performance Instance */
|
|
8
|
-
export declare const Performance: {
|
|
9
|
-
startPerf: typeof _startPerf;
|
|
10
|
-
endPerf: typeof _endPerf;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
1
|
+
/**@format */
|
|
2
|
+
import { ILog, IPerfRecorder } from "../types/Logs";
|
|
3
|
+
declare function _startPerf(id?: string): IPerfRecorder;
|
|
4
|
+
declare function _endPerf(recorder: IPerfRecorder, console?: boolean): number;
|
|
5
|
+
/** Tianyu Log Instance */
|
|
6
|
+
export declare const Log: ILog;
|
|
7
|
+
/** Tianyu Performance Instance */
|
|
8
|
+
export declare const Performance: {
|
|
9
|
+
startPerf: typeof _startPerf;
|
|
10
|
+
endPerf: typeof _endPerf;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
export declare function getBoolean(value: any): boolean;
|
|
1
|
+
/**@format */
|
|
2
|
+
export declare function getBoolean(value: any): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { IComparable } from "
|
|
3
|
-
export interface ITianyuJSON extends IComparable {
|
|
4
|
-
toString(): string;
|
|
5
|
-
}
|
|
1
|
+
/** @format */
|
|
2
|
+
import { IComparable } from "../../../src/types/Types";
|
|
3
|
+
export interface ITianyuJSON extends IComparable {
|
|
4
|
+
toString(): string;
|
|
5
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { IComparable } from "
|
|
3
|
-
export interface ITianyuType extends IComparable {
|
|
4
|
-
toString(): string;
|
|
5
|
-
}
|
|
1
|
+
/** @format */
|
|
2
|
+
import { IComparable } from "../../../src/types/Types";
|
|
3
|
+
export interface ITianyuType extends IComparable {
|
|
4
|
+
toString(): string;
|
|
5
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
/** Array type related tools */
|
|
3
|
-
export declare class ArrayHelper {
|
|
4
|
-
/**
|
|
5
|
-
* To merge multiple arrays into a new array and remove duplicated elements.
|
|
6
|
-
*
|
|
7
|
-
* @param {any[]} array arrays
|
|
8
|
-
* @returns return a new array
|
|
9
|
-
*/
|
|
10
|
-
static merge(...array: any[]): any[];
|
|
11
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
/** Array type related tools */
|
|
3
|
+
export declare class ArrayHelper {
|
|
4
|
+
/**
|
|
5
|
+
* To merge multiple arrays into a new array and remove duplicated elements.
|
|
6
|
+
*
|
|
7
|
+
* @param {any[]} array arrays
|
|
8
|
+
* @returns return a new array
|
|
9
|
+
*/
|
|
10
|
+
static merge(...array: any[]): any[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/** Bytes Object type */
|
|
5
|
+
export declare class Bytes {
|
|
6
|
+
/**
|
|
7
|
+
* Get a bytes buffer filled with random data
|
|
8
|
+
*
|
|
9
|
+
* @param size the length of bytes buffer
|
|
10
|
+
* @returns buffer
|
|
11
|
+
*/
|
|
12
|
+
static random(size: number): Buffer;
|
|
13
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
import { ObjectDiffMap } from "
|
|
3
|
-
/** Object Calculation Manager of Tianyu to provide data changes delta calculation and merge */
|
|
4
|
-
export declare class ObjectCalculater {
|
|
5
|
-
/**
|
|
6
|
-
* Compare two objects and get the delta changes between the two objects
|
|
7
|
-
*
|
|
8
|
-
* @param previous the previous object
|
|
9
|
-
* @param newest the newest object
|
|
10
|
-
* @returns return the defferents map
|
|
11
|
-
*/
|
|
12
|
-
static calculateDiff(previous: any, newest: any): ObjectDiffMap;
|
|
13
|
-
/**
|
|
14
|
-
* Merge the object value status from one to another one following with the object different maps
|
|
15
|
-
*
|
|
16
|
-
* @param value the raw value(status)
|
|
17
|
-
* @param diffs the value changed status map array, contains multiply status maps and the status merge will be one by one.
|
|
18
|
-
* @param strict a boolean value used to whether the program needs a strict status check to avoid some data errors
|
|
19
|
-
* @returns return a new value status
|
|
20
|
-
*/
|
|
21
|
-
static mergeDiff(value: any, diffs: ObjectDiffMap[], strict?: boolean): any;
|
|
22
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
import { ObjectDiffMap } from "../../types/Object";
|
|
3
|
+
/** Object Calculation Manager of Tianyu to provide data changes delta calculation and merge */
|
|
4
|
+
export declare class ObjectCalculater {
|
|
5
|
+
/**
|
|
6
|
+
* Compare two objects and get the delta changes between the two objects
|
|
7
|
+
*
|
|
8
|
+
* @param previous the previous object
|
|
9
|
+
* @param newest the newest object
|
|
10
|
+
* @returns return the defferents map
|
|
11
|
+
*/
|
|
12
|
+
static calculateDiff(previous: any, newest: any): ObjectDiffMap;
|
|
13
|
+
/**
|
|
14
|
+
* Merge the object value status from one to another one following with the object different maps
|
|
15
|
+
*
|
|
16
|
+
* @param value the raw value(status)
|
|
17
|
+
* @param diffs the value changed status map array, contains multiply status maps and the status merge will be one by one.
|
|
18
|
+
* @param strict a boolean value used to whether the program needs a strict status check to avoid some data errors
|
|
19
|
+
* @returns return a new value status
|
|
20
|
+
*/
|
|
21
|
+
static mergeDiff(value: any, diffs: ObjectDiffMap[], strict?: boolean): any;
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
/** DataView Object Type */
|
|
3
|
+
export declare class DataView {
|
|
4
|
+
/**
|
|
5
|
+
* Create a new node:DataView from given data buffer
|
|
6
|
+
*
|
|
7
|
+
* @param data source data buffer
|
|
8
|
+
* @returns return node:DataView type equals to given data buffer
|
|
9
|
+
*/
|
|
10
|
+
static parse(data: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray): globalThis.DataView;
|
|
11
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
/** Integer Object Type */
|
|
3
|
+
export declare class Integer {
|
|
4
|
+
/**
|
|
5
|
+
* Get a random integer between min value and max value.
|
|
6
|
+
* min value should greater than 0, max value should less than 2^48-1 (281474976710655)
|
|
7
|
+
*
|
|
8
|
+
* @param min the min value (0 will be applied when not given)
|
|
9
|
+
* @param max the max value (281474976710655 will be applied when not given)
|
|
10
|
+
* @returns return the random value
|
|
11
|
+
*/
|
|
12
|
+
static random(min?: number, max?: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* convert source number to be a 8-byte array
|
|
15
|
+
*
|
|
16
|
+
* @param srcValue source value
|
|
17
|
+
* @returns return a 8-byte array
|
|
18
|
+
*/
|
|
19
|
+
static toBytes(srcValue: number): number[];
|
|
20
|
+
/**
|
|
21
|
+
* number left shift
|
|
22
|
+
* times will be calculated to get the end 6-bit at the beginning to avoid over-flow
|
|
23
|
+
*
|
|
24
|
+
* @param value source value
|
|
25
|
+
* @param times left shift steps
|
|
26
|
+
* @returns return result value
|
|
27
|
+
*/
|
|
28
|
+
static left(value: number, times: number): number;
|
|
29
|
+
/**
|
|
30
|
+
* number right shift
|
|
31
|
+
* times will be calculated to get the end 6-bit at the beginning to avoid over-flow
|
|
32
|
+
*
|
|
33
|
+
* @param value source value
|
|
34
|
+
* @param times right shift steps
|
|
35
|
+
* @returns return result value
|
|
36
|
+
*/
|
|
37
|
+
static right(value: number, times: number): number;
|
|
38
|
+
/**
|
|
39
|
+
* number unsigned right shift
|
|
40
|
+
* times will be calculated to get the end 6-bit at the beginning to avoid over-flow
|
|
41
|
+
*
|
|
42
|
+
* @param value source value
|
|
43
|
+
* @param times right shift steps
|
|
44
|
+
* @returns return result value
|
|
45
|
+
*/
|
|
46
|
+
static rightUnsigned(value: number, times: number): number;
|
|
47
|
+
/**
|
|
48
|
+
* or
|
|
49
|
+
*
|
|
50
|
+
* @param value1 the first value
|
|
51
|
+
* @param values the following values array
|
|
52
|
+
* @returns return calculated value
|
|
53
|
+
*/
|
|
54
|
+
static or(value1: number, ...values: number[]): number;
|
|
55
|
+
/**
|
|
56
|
+
* and
|
|
57
|
+
*
|
|
58
|
+
* @param value1 the first value
|
|
59
|
+
* @param values the following values array
|
|
60
|
+
* @returns return calculated value
|
|
61
|
+
*/
|
|
62
|
+
static and(value1: number, ...values: number[]): number;
|
|
63
|
+
/**
|
|
64
|
+
* xor
|
|
65
|
+
*
|
|
66
|
+
* @param value1 the first value
|
|
67
|
+
* @param value2 the second value
|
|
68
|
+
* @returns return calculated value
|
|
69
|
+
*/
|
|
70
|
+
static xor(value1: number, value2: number): number;
|
|
71
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
/** Json Lib */
|
|
3
|
+
export declare class Json {
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
*
|
|
7
|
+
* convert a string to be a javascript object.
|
|
8
|
+
* This is an unsafe function to convert a string to be object. suggest to use parseSafe to convert string to object.
|
|
9
|
+
*
|
|
10
|
+
* @param src source string
|
|
11
|
+
* @returns target js-object
|
|
12
|
+
*/
|
|
13
|
+
static parse(src: string): any;
|
|
14
|
+
/**
|
|
15
|
+
* convert a string to be a javascript object safty
|
|
16
|
+
*
|
|
17
|
+
* @param src source string
|
|
18
|
+
* @param failed value returned when converted failed, default is null
|
|
19
|
+
* @returns target js-object
|
|
20
|
+
*/
|
|
21
|
+
static parseSafe(src: string, failed?: any): any | null;
|
|
22
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
/** Object Helper of Tianyu to provide data type checking, objects comparing, validation, data clone and other functions */
|
|
3
|
-
export declare class ObjectHelper {
|
|
4
|
-
/**
|
|
5
|
-
* check whether the specified value does extend from nodejs native type
|
|
6
|
-
*
|
|
7
|
-
* @param {any} value supported value type of tianyu store
|
|
8
|
-
* @returns {boolean} return true if the value is based on type number, string, boolean, function, otherwise false
|
|
9
|
-
*/
|
|
10
|
-
static isSimpleDataType(value: any): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* get a deep copy from source
|
|
13
|
-
*
|
|
14
|
-
* @param {any} sources the specified source value
|
|
15
|
-
* @returns {any} return a new value that is independent from sources
|
|
16
|
-
*/
|
|
17
|
-
static clone(source: any): any;
|
|
18
|
-
private static _clone;
|
|
19
|
-
private static _cloneArray;
|
|
20
|
-
private static _cloneRecordType;
|
|
21
|
-
/**
|
|
22
|
-
* Check the object whether can be stringified
|
|
23
|
-
*
|
|
24
|
-
* @param obj be checked object
|
|
25
|
-
* @returns return true is valid, otherwise false
|
|
26
|
-
*/
|
|
27
|
-
static validateSerializable(obj: any): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Compare two or more objects are the same or different
|
|
30
|
-
*
|
|
31
|
-
* @param objs the objects which need to be compared
|
|
32
|
-
* @returns same - if all the objects are same, different - if at least one object is not same to other objects
|
|
33
|
-
* @description if there are only one parameter or no parameter is provided, same result will be returned
|
|
34
|
-
*/
|
|
35
|
-
static compareObjects(...objs: any): "same" | "different";
|
|
36
|
-
private static _compareSimpleType;
|
|
37
|
-
private static _compareArrayType;
|
|
38
|
-
private static _compareObjectType;
|
|
39
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
/** Object Helper of Tianyu to provide data type checking, objects comparing, validation, data clone and other functions */
|
|
3
|
+
export declare class ObjectHelper {
|
|
4
|
+
/**
|
|
5
|
+
* check whether the specified value does extend from nodejs native type
|
|
6
|
+
*
|
|
7
|
+
* @param {any} value supported value type of tianyu store
|
|
8
|
+
* @returns {boolean} return true if the value is based on type number, string, boolean, function, otherwise false
|
|
9
|
+
*/
|
|
10
|
+
static isSimpleDataType(value: any): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* get a deep copy from source
|
|
13
|
+
*
|
|
14
|
+
* @param {any} sources the specified source value
|
|
15
|
+
* @returns {any} return a new value that is independent from sources
|
|
16
|
+
*/
|
|
17
|
+
static clone(source: any): any;
|
|
18
|
+
private static _clone;
|
|
19
|
+
private static _cloneArray;
|
|
20
|
+
private static _cloneRecordType;
|
|
21
|
+
/**
|
|
22
|
+
* Check the object whether can be stringified
|
|
23
|
+
*
|
|
24
|
+
* @param obj be checked object
|
|
25
|
+
* @returns return true is valid, otherwise false
|
|
26
|
+
*/
|
|
27
|
+
static validateSerializable(obj: any): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Compare two or more objects are the same or different
|
|
30
|
+
*
|
|
31
|
+
* @param objs the objects which need to be compared
|
|
32
|
+
* @returns same - if all the objects are same, different - if at least one object is not same to other objects
|
|
33
|
+
* @description if there are only one parameter or no parameter is provided, same result will be returned
|
|
34
|
+
*/
|
|
35
|
+
static compareObjects(...objs: any): "same" | "different";
|
|
36
|
+
private static _compareSimpleType;
|
|
37
|
+
private static _compareArrayType;
|
|
38
|
+
private static _compareObjectType;
|
|
39
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**@format */
|
|
2
|
+
export declare class StringHelper {
|
|
3
|
+
static format(source: string, args?: (string | number)[] | string): string;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
*
|
|
7
|
+
* convert an object to be a string.
|
|
8
|
+
* This is an unsafe function to convert an object to be string. suggest to use stringifySafe to convert object to string.
|
|
9
|
+
*
|
|
10
|
+
* @param src source object
|
|
11
|
+
* @returns target string
|
|
12
|
+
*/
|
|
13
|
+
static stringify(data: any): string;
|
|
14
|
+
/**
|
|
15
|
+
* convert an object to be a string safty. empty string will be return when error occurs in converting
|
|
16
|
+
*
|
|
17
|
+
* @param src source object
|
|
18
|
+
* @returns target string
|
|
19
|
+
*/
|
|
20
|
+
static stringifySafe(data: any): string;
|
|
21
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
export declare class TArray<T> {
|
|
3
|
-
}
|
|
1
|
+
/** @format */
|
|
2
|
+
export declare class TArray<T> {
|
|
3
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
export declare class TBoolean {
|
|
3
|
-
}
|
|
1
|
+
/** @format */
|
|
2
|
+
export declare class TBoolean {
|
|
3
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
export declare class TJSON {
|
|
3
|
-
}
|
|
1
|
+
/** @format */
|
|
2
|
+
export declare class TJSON {
|
|
3
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
export declare class TNumber {
|
|
3
|
-
}
|
|
1
|
+
/** @format */
|
|
2
|
+
export declare class TNumber {
|
|
3
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
export declare class TObject {
|
|
3
|
-
}
|
|
1
|
+
/** @format */
|
|
2
|
+
export declare class TObject {
|
|
3
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
export declare class TString {
|
|
3
|
-
}
|
|
1
|
+
/** @format */
|
|
2
|
+
export declare class TString {
|
|
3
|
+
}
|