@aitianyu.cn/types 0.0.12 → 0.1.0
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 +70 -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/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 +29 -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/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,18 +1,18 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
import { TMap } from "./TMap";
|
|
3
|
-
import { PathBase } from "./PathBase";
|
|
4
|
-
/** Tianyu Object calculated different item */
|
|
5
|
-
export interface IObjectDiffInfo {
|
|
6
|
-
/** different item path */
|
|
7
|
-
path: string;
|
|
8
|
-
/** the old value of this path */
|
|
9
|
-
old: any;
|
|
10
|
-
/** the new value of this path */
|
|
11
|
-
new: any;
|
|
12
|
-
/** does the change be deletion */
|
|
13
|
-
deleted?: true;
|
|
14
|
-
/** does the change be adding */
|
|
15
|
-
added?: true;
|
|
16
|
-
}
|
|
17
|
-
/** Different items map */
|
|
18
|
-
export type ObjectDiffMap = TMap<PathBase, IObjectDiffInfo>;
|
|
1
|
+
/**@format */
|
|
2
|
+
import { TMap } from "./TMap";
|
|
3
|
+
import { PathBase } from "./PathBase";
|
|
4
|
+
/** Tianyu Object calculated different item */
|
|
5
|
+
export interface IObjectDiffInfo {
|
|
6
|
+
/** different item path */
|
|
7
|
+
path: string;
|
|
8
|
+
/** the old value of this path */
|
|
9
|
+
old: any;
|
|
10
|
+
/** the new value of this path */
|
|
11
|
+
new: any;
|
|
12
|
+
/** does the change be deletion */
|
|
13
|
+
deleted?: true;
|
|
14
|
+
/** does the change be adding */
|
|
15
|
+
added?: true;
|
|
16
|
+
}
|
|
17
|
+
/** Different items map */
|
|
18
|
+
export type ObjectDiffMap = TMap<PathBase, IObjectDiffInfo>;
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
import { IComparable } from "./Types";
|
|
3
|
-
/** Path base class */
|
|
4
|
-
export declare class PathBase implements IComparable {
|
|
5
|
-
protected _dirs: string[];
|
|
6
|
-
/**
|
|
7
|
-
* Create a Path instance by specified dirs
|
|
8
|
-
*
|
|
9
|
-
* @param dirs the specified directories
|
|
10
|
-
*/
|
|
11
|
-
constructor(dirs?: string[]);
|
|
12
|
-
/**
|
|
13
|
-
* Convert the path instance to string
|
|
14
|
-
*
|
|
15
|
-
* @returns return the fromatted string
|
|
16
|
-
*/
|
|
17
|
-
toString(): string;
|
|
18
|
-
/**
|
|
19
|
-
* Iterator of path directories
|
|
20
|
-
*
|
|
21
|
-
* @returns return an iterator
|
|
22
|
-
*/
|
|
23
|
-
[Symbol.iterator](): {
|
|
24
|
-
next: () => {
|
|
25
|
-
done: boolean;
|
|
26
|
-
value: string;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Get a directories array deep copy
|
|
31
|
-
*
|
|
32
|
-
* @returns return directories
|
|
33
|
-
*/
|
|
34
|
-
getDirs(): string[];
|
|
35
|
-
/**
|
|
36
|
-
* Get a number that indicates the directories count
|
|
37
|
-
*
|
|
38
|
-
* @returns return the directories count
|
|
39
|
-
*/
|
|
40
|
-
length(): number;
|
|
41
|
-
/**
|
|
42
|
-
* Append a new directory to the end of path
|
|
43
|
-
*
|
|
44
|
-
* @param dir the new directory name
|
|
45
|
-
* @returns return the new directories count
|
|
46
|
-
*/
|
|
47
|
-
append(dir: string): number;
|
|
48
|
-
/**
|
|
49
|
-
* Clean all the pathes
|
|
50
|
-
*/
|
|
51
|
-
clear(): void;
|
|
52
|
-
/**
|
|
53
|
-
* Remove the end directory of the path instance and return it
|
|
54
|
-
*
|
|
55
|
-
* @returns return the end of directory
|
|
56
|
-
*/
|
|
57
|
-
pop(): string | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* Remove the first directory of the path instance and return it
|
|
60
|
-
*
|
|
61
|
-
* @returns return the first directory
|
|
62
|
-
*/
|
|
63
|
-
shift(): string | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* Convert the path instance to string for object comparing
|
|
66
|
-
*
|
|
67
|
-
* @returns return the comparable string
|
|
68
|
-
*/
|
|
69
|
-
getString(): string;
|
|
70
|
-
/**
|
|
71
|
-
* Get the hashcode of current path
|
|
72
|
-
*
|
|
73
|
-
* @returns always return 0
|
|
74
|
-
*/
|
|
75
|
-
getHashCode(): number;
|
|
76
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
import { IComparable } from "./Types";
|
|
3
|
+
/** Path base class */
|
|
4
|
+
export declare class PathBase implements IComparable {
|
|
5
|
+
protected _dirs: string[];
|
|
6
|
+
/**
|
|
7
|
+
* Create a Path instance by specified dirs
|
|
8
|
+
*
|
|
9
|
+
* @param dirs the specified directories
|
|
10
|
+
*/
|
|
11
|
+
constructor(dirs?: string[]);
|
|
12
|
+
/**
|
|
13
|
+
* Convert the path instance to string
|
|
14
|
+
*
|
|
15
|
+
* @returns return the fromatted string
|
|
16
|
+
*/
|
|
17
|
+
toString(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Iterator of path directories
|
|
20
|
+
*
|
|
21
|
+
* @returns return an iterator
|
|
22
|
+
*/
|
|
23
|
+
[Symbol.iterator](): {
|
|
24
|
+
next: () => {
|
|
25
|
+
done: boolean;
|
|
26
|
+
value: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Get a directories array deep copy
|
|
31
|
+
*
|
|
32
|
+
* @returns return directories
|
|
33
|
+
*/
|
|
34
|
+
getDirs(): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Get a number that indicates the directories count
|
|
37
|
+
*
|
|
38
|
+
* @returns return the directories count
|
|
39
|
+
*/
|
|
40
|
+
length(): number;
|
|
41
|
+
/**
|
|
42
|
+
* Append a new directory to the end of path
|
|
43
|
+
*
|
|
44
|
+
* @param dir the new directory name
|
|
45
|
+
* @returns return the new directories count
|
|
46
|
+
*/
|
|
47
|
+
append(dir: string): number;
|
|
48
|
+
/**
|
|
49
|
+
* Clean all the pathes
|
|
50
|
+
*/
|
|
51
|
+
clear(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Remove the end directory of the path instance and return it
|
|
54
|
+
*
|
|
55
|
+
* @returns return the end of directory
|
|
56
|
+
*/
|
|
57
|
+
pop(): string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Remove the first directory of the path instance and return it
|
|
60
|
+
*
|
|
61
|
+
* @returns return the first directory
|
|
62
|
+
*/
|
|
63
|
+
shift(): string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Convert the path instance to string for object comparing
|
|
66
|
+
*
|
|
67
|
+
* @returns return the comparable string
|
|
68
|
+
*/
|
|
69
|
+
getString(): string;
|
|
70
|
+
/**
|
|
71
|
+
* Get the hashcode of current path
|
|
72
|
+
*
|
|
73
|
+
* @returns always return 0
|
|
74
|
+
*/
|
|
75
|
+
getHashCode(): number;
|
|
76
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
/** Encrypt Option Type */
|
|
3
|
-
export declare enum EncryptOption {
|
|
4
|
-
Encryption = 0,
|
|
5
|
-
Decryption = 1
|
|
6
|
-
}
|
|
7
|
-
/** An Interface of the Cipher */
|
|
8
|
-
export interface ICipher {
|
|
9
|
-
/**
|
|
10
|
-
* To encode the source value
|
|
11
|
-
*
|
|
12
|
-
* @param source the source value
|
|
13
|
-
* @returns return the encoded value
|
|
14
|
-
*/
|
|
15
|
-
encryption(source: number[]): number[];
|
|
16
|
-
/**
|
|
17
|
-
* To decode the encoded value
|
|
18
|
-
*
|
|
19
|
-
* @param source the encoded value
|
|
20
|
-
* @returns return the decoded value
|
|
21
|
-
*/
|
|
22
|
-
decryption(source: number[]): number[];
|
|
23
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
/** Encrypt Option Type */
|
|
3
|
+
export declare enum EncryptOption {
|
|
4
|
+
Encryption = 0,
|
|
5
|
+
Decryption = 1
|
|
6
|
+
}
|
|
7
|
+
/** An Interface of the Cipher */
|
|
8
|
+
export interface ICipher {
|
|
9
|
+
/**
|
|
10
|
+
* To encode the source value
|
|
11
|
+
*
|
|
12
|
+
* @param source the source value
|
|
13
|
+
* @returns return the encoded value
|
|
14
|
+
*/
|
|
15
|
+
encryption(source: number[]): number[];
|
|
16
|
+
/**
|
|
17
|
+
* To decode the encoded value
|
|
18
|
+
*
|
|
19
|
+
* @param source the encoded value
|
|
20
|
+
* @returns return the decoded value
|
|
21
|
+
*/
|
|
22
|
+
decryption(source: number[]): number[];
|
|
23
|
+
}
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
import { IComparable } from "./Types";
|
|
3
|
-
/**
|
|
4
|
-
* Tianyu Map
|
|
5
|
-
* Support Customized Object type
|
|
6
|
-
*/
|
|
7
|
-
export declare class TMap<K extends IComparable, V> {
|
|
8
|
-
private _map;
|
|
9
|
-
private _kMap;
|
|
10
|
-
/**
|
|
11
|
-
* Create an empty Tianyu Map Instance
|
|
12
|
-
*/
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* Clean the Map instance
|
|
16
|
-
*/
|
|
17
|
-
clear(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Delete a specified item from the instance
|
|
20
|
-
*
|
|
21
|
-
* @param key The key of the item
|
|
22
|
-
* @returns return true if deleted successful and return false if failed
|
|
23
|
-
*/
|
|
24
|
-
delete(key: K): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Executes a provided function once per each key/value pair in the Map, in insertion order.
|
|
27
|
-
*
|
|
28
|
-
* @param callbackfn provided execution function
|
|
29
|
-
* @param thisArg additional args
|
|
30
|
-
*/
|
|
31
|
-
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
|
|
32
|
-
/**
|
|
33
|
-
* Returns a specified element from the Map object. If the value that is associated to the provided key is an object,
|
|
34
|
-
* then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
|
|
35
|
-
*
|
|
36
|
-
* @param key The key of the value
|
|
37
|
-
* @returns Returns the element associated with the specified key.
|
|
38
|
-
* If no element is associated with the specified key, undefined is returned.
|
|
39
|
-
*/
|
|
40
|
-
get(key: K): V | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Get a boolean value indicates whether an element with the specified key exists or not.
|
|
43
|
-
*
|
|
44
|
-
* @param key The key what wants to search
|
|
45
|
-
* @returns return true if the value is found
|
|
46
|
-
*/
|
|
47
|
-
has(key: K): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
|
|
50
|
-
*
|
|
51
|
-
* @param key The key of new element
|
|
52
|
-
* @param value The value of new element
|
|
53
|
-
* @returns return the instance that is current instance
|
|
54
|
-
*/
|
|
55
|
-
set(key: K, value: V): this;
|
|
56
|
-
/**
|
|
57
|
-
* Get a number of elements in the Map
|
|
58
|
-
*
|
|
59
|
-
* @returns return the count of elements
|
|
60
|
-
*/
|
|
61
|
-
size(): number;
|
|
62
|
-
/**
|
|
63
|
-
* Get all keys of the Map
|
|
64
|
-
*
|
|
65
|
-
* @returns return a keys iterator
|
|
66
|
-
*/
|
|
67
|
-
keys(): IterableIterator<K>;
|
|
68
|
-
/**
|
|
69
|
-
* Get all values of the Map
|
|
70
|
-
*
|
|
71
|
-
* @returns return a values iterator
|
|
72
|
-
*/
|
|
73
|
-
values(): IterableIterator<V>;
|
|
74
|
-
/**
|
|
75
|
-
* Get an Iterator of the Map
|
|
76
|
-
*
|
|
77
|
-
* @returns return an iterator object
|
|
78
|
-
*/
|
|
79
|
-
[Symbol.iterator](): Iterator<[K | undefined, V | undefined]>;
|
|
80
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
import { IComparable } from "./Types";
|
|
3
|
+
/**
|
|
4
|
+
* Tianyu Map
|
|
5
|
+
* Support Customized Object type
|
|
6
|
+
*/
|
|
7
|
+
export declare class TMap<K extends IComparable, V> {
|
|
8
|
+
private _map;
|
|
9
|
+
private _kMap;
|
|
10
|
+
/**
|
|
11
|
+
* Create an empty Tianyu Map Instance
|
|
12
|
+
*/
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Clean the Map instance
|
|
16
|
+
*/
|
|
17
|
+
clear(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Delete a specified item from the instance
|
|
20
|
+
*
|
|
21
|
+
* @param key The key of the item
|
|
22
|
+
* @returns return true if deleted successful and return false if failed
|
|
23
|
+
*/
|
|
24
|
+
delete(key: K): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Executes a provided function once per each key/value pair in the Map, in insertion order.
|
|
27
|
+
*
|
|
28
|
+
* @param callbackfn provided execution function
|
|
29
|
+
* @param thisArg additional args
|
|
30
|
+
*/
|
|
31
|
+
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a specified element from the Map object. If the value that is associated to the provided key is an object,
|
|
34
|
+
* then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
|
|
35
|
+
*
|
|
36
|
+
* @param key The key of the value
|
|
37
|
+
* @returns Returns the element associated with the specified key.
|
|
38
|
+
* If no element is associated with the specified key, undefined is returned.
|
|
39
|
+
*/
|
|
40
|
+
get(key: K): V | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Get a boolean value indicates whether an element with the specified key exists or not.
|
|
43
|
+
*
|
|
44
|
+
* @param key The key what wants to search
|
|
45
|
+
* @returns return true if the value is found
|
|
46
|
+
*/
|
|
47
|
+
has(key: K): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
|
|
50
|
+
*
|
|
51
|
+
* @param key The key of new element
|
|
52
|
+
* @param value The value of new element
|
|
53
|
+
* @returns return the instance that is current instance
|
|
54
|
+
*/
|
|
55
|
+
set(key: K, value: V): this;
|
|
56
|
+
/**
|
|
57
|
+
* Get a number of elements in the Map
|
|
58
|
+
*
|
|
59
|
+
* @returns return the count of elements
|
|
60
|
+
*/
|
|
61
|
+
size(): number;
|
|
62
|
+
/**
|
|
63
|
+
* Get all keys of the Map
|
|
64
|
+
*
|
|
65
|
+
* @returns return a keys iterator
|
|
66
|
+
*/
|
|
67
|
+
keys(): IterableIterator<K>;
|
|
68
|
+
/**
|
|
69
|
+
* Get all values of the Map
|
|
70
|
+
*
|
|
71
|
+
* @returns return a values iterator
|
|
72
|
+
*/
|
|
73
|
+
values(): IterableIterator<V>;
|
|
74
|
+
/**
|
|
75
|
+
* Get an Iterator of the Map
|
|
76
|
+
*
|
|
77
|
+
* @returns return an iterator object
|
|
78
|
+
*/
|
|
79
|
+
[Symbol.iterator](): Iterator<[K | undefined, V | undefined]>;
|
|
80
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
/**A record object type of boolean */
|
|
3
|
-
export type MapOfBoolean = Record<string, boolean>;
|
|
4
|
-
/**A record object type of string array */
|
|
5
|
-
export type MapOfStrings = Record<string, string[]>;
|
|
6
|
-
/**A record object type of string */
|
|
7
|
-
export type MapOfString = Record<string, string>;
|
|
8
|
-
/**A record object type of customized */
|
|
9
|
-
export type MapOfType<T> = Record<string, T>;
|
|
10
|
-
/** no parameter call back function */
|
|
11
|
-
export type CallbackAction = () => void;
|
|
12
|
-
/** call back function with customized type parameter */
|
|
13
|
-
export type CallbackActionT<T> = (value: T) => void;
|
|
14
|
-
/** A key value pair to include a key and a value */
|
|
15
|
-
export
|
|
16
|
-
key: K;
|
|
17
|
-
value: V;
|
|
18
|
-
}
|
|
19
|
-
/** Tianyu Comparable Interface */
|
|
20
|
-
export interface IComparable {
|
|
21
|
-
/** Get a string what can indicate the object unified */
|
|
22
|
-
getString(): string;
|
|
23
|
-
/** Get a number which is the hash value of the object instance */
|
|
24
|
-
getHashCode(): number;
|
|
25
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
/**A record object type of boolean */
|
|
3
|
+
export type MapOfBoolean = Record<string, boolean>;
|
|
4
|
+
/**A record object type of string array */
|
|
5
|
+
export type MapOfStrings = Record<string, string[]>;
|
|
6
|
+
/**A record object type of string */
|
|
7
|
+
export type MapOfString = Record<string, string>;
|
|
8
|
+
/**A record object type of customized */
|
|
9
|
+
export type MapOfType<T> = Record<string, T>;
|
|
10
|
+
/** no parameter call back function */
|
|
11
|
+
export type CallbackAction = () => void;
|
|
12
|
+
/** call back function with customized type parameter */
|
|
13
|
+
export type CallbackActionT<T> = (value: T) => void;
|
|
14
|
+
/** A key value pair to include a key and a value */
|
|
15
|
+
export interface KeyValuePair<K, V> {
|
|
16
|
+
key: K;
|
|
17
|
+
value: V;
|
|
18
|
+
}
|
|
19
|
+
/** Tianyu Comparable Interface */
|
|
20
|
+
export interface IComparable {
|
|
21
|
+
/** Get a string what can indicate the object unified */
|
|
22
|
+
getString(): string;
|
|
23
|
+
/** Get a number which is the hash value of the object instance */
|
|
24
|
+
getHashCode(): number;
|
|
25
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
export { AreaCode } from "./AreaCode";
|
|
3
|
-
export { Exception } from "./Exception";
|
|
4
|
-
export { LogLevel, type ILog, type IPerfRecorder } from "./Logs";
|
|
5
|
-
export { type IObjectDiffInfo, type ObjectDiffMap } from "./Object";
|
|
6
|
-
export { PathBase } from "./PathBase";
|
|
7
|
-
export { EncryptOption, type ICipher } from "./Security";
|
|
8
|
-
export { TMap } from "./TMap";
|
|
9
|
-
export { type MapOfBoolean, type MapOfStrings, type MapOfString, type MapOfType, type CallbackAction, type CallbackActionT, type IComparable, } from "./Types";
|
|
1
|
+
/**@format */
|
|
2
|
+
export { AreaCode } from "./AreaCode";
|
|
3
|
+
export { Exception } from "./Exception";
|
|
4
|
+
export { LogLevel, type ILog, type IPerfRecorder } from "./Logs";
|
|
5
|
+
export { type IObjectDiffInfo, type ObjectDiffMap } from "./Object";
|
|
6
|
+
export { PathBase } from "./PathBase";
|
|
7
|
+
export { EncryptOption, type ICipher } from "./Security";
|
|
8
|
+
export { TMap } from "./TMap";
|
|
9
|
+
export { type MapOfBoolean, type MapOfStrings, type MapOfString, type MapOfType, type CallbackAction, type CallbackActionT, type IComparable, } from "./Types";
|
package/package.json
CHANGED
|
@@ -1,51 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@aitianyu.cn/types",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"private": false,
|
|
5
|
-
"description": "Common modules (types, functions, classes) for aitianyu",
|
|
6
|
-
"main": "./dist/lib/index.js",
|
|
7
|
-
"types": "./dist/types/index.d.ts",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"@
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"jest
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@aitianyu.cn/types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Common modules (types, functions, classes) for aitianyu",
|
|
6
|
+
"main": "./dist/lib/index.js",
|
|
7
|
+
"types": "./dist/types/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"type": "commonjs",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"aitianyu.cn",
|
|
14
|
+
"base type",
|
|
15
|
+
"common lib"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"start": "ts-node packages/index.ts",
|
|
19
|
+
"build": "eslint \"./\" --quiet && npm run before-build && npm run compiler && npm run copy-lib && npm run copy-types && npm run after-build",
|
|
20
|
+
"compiler": "tsc && tsc-alias",
|
|
21
|
+
"copy-lib": "copyfiles -u 2 \"build/src/**/*.js\" \"dist/lib\"",
|
|
22
|
+
"copy-types": "copyfiles -u 2 \"build/src/**/*.d.ts\" \"dist/types\"",
|
|
23
|
+
"before-build": "rimraf ./dist ./build",
|
|
24
|
+
"after-build": "rimraf ./build",
|
|
25
|
+
"test": "jest --no-cache --verbose",
|
|
26
|
+
"test-all": "jest --no-cache --verbose --coverage && npm run eslint-report",
|
|
27
|
+
"test-coverage": "jest --no-cache --coverage",
|
|
28
|
+
"eslint": "eslint . --format json --output-file \"./test/__report__/eslint/eslint-report.json\"",
|
|
29
|
+
"eslint-report": "eslint . --format html --output-file \"./test/__report__/eslint/eslint-report.html\""
|
|
30
|
+
},
|
|
31
|
+
"author": "dev@aitianyu.cn",
|
|
32
|
+
"license": "ISC",
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@eslint/compat": "^1.3.1",
|
|
35
|
+
"@stylistic/eslint-plugin": "^5.2.2",
|
|
36
|
+
"@types/jest": "^29.2.4",
|
|
37
|
+
"@types/node": "^18.11.15",
|
|
38
|
+
"@types/qrcode": "^1.5.5",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
40
|
+
"copyfiles": "^2.4.1",
|
|
41
|
+
"eslint": "^9.32.0",
|
|
42
|
+
"eslint-plugin-import": "^2.32.0",
|
|
43
|
+
"jest": "^29.3.1",
|
|
44
|
+
"jest-html-reporters": "^3.0.11",
|
|
45
|
+
"jiti": "^2.5.1",
|
|
46
|
+
"perf_hooks": "0.0.1",
|
|
47
|
+
"rimraf": "^3.0.2",
|
|
48
|
+
"ts-jest": "^29.0.3",
|
|
49
|
+
"ts-node": "^10.9.1",
|
|
50
|
+
"tsc-alias": "^1.8.2",
|
|
51
|
+
"typescript": "^4.9.3",
|
|
52
|
+
"typescript-eslint": "^8.38.0"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"qrcode": "^1.5.4"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Path = exports.PathDirAndFileConvertInvaild = exports.PathDirectoryValidationFailException = exports.PathProcessorSourceLostException = void 0;
|
|
5
|
-
var Error_1 = require("./Error");
|
|
6
|
-
Object.defineProperty(exports, "PathProcessorSourceLostException", { enumerable: true, get: function () { return Error_1.PathProcessorSourceLostException; } });
|
|
7
|
-
Object.defineProperty(exports, "PathDirectoryValidationFailException", { enumerable: true, get: function () { return Error_1.PathDirectoryValidationFailException; } });
|
|
8
|
-
Object.defineProperty(exports, "PathDirAndFileConvertInvaild", { enumerable: true, get: function () { return Error_1.PathDirAndFileConvertInvaild; } });
|
|
9
|
-
var Path_1 = require("./Path");
|
|
10
|
-
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Path_1.Path; } });
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ObjectHelper = exports.ObjectCalculater = exports.Performance = exports.Log = exports.parseAreaString = exports.parseAreaCode = exports.ObjectDiffMergeFailedException = exports.ObjectDiffApplyInvalidStatusException = exports.ObjectMergeStatusCheckFailedException = exports.ObjectCloneFunctionNotSupportException = exports.ArgumentNullOrEmptyException = void 0;
|
|
5
|
-
var Errors_1 = require("./Errors");
|
|
6
|
-
Object.defineProperty(exports, "ArgumentNullOrEmptyException", { enumerable: true, get: function () { return Errors_1.ArgumentNullOrEmptyException; } });
|
|
7
|
-
Object.defineProperty(exports, "ObjectCloneFunctionNotSupportException", { enumerable: true, get: function () { return Errors_1.ObjectCloneFunctionNotSupportException; } });
|
|
8
|
-
Object.defineProperty(exports, "ObjectMergeStatusCheckFailedException", { enumerable: true, get: function () { return Errors_1.ObjectMergeStatusCheckFailedException; } });
|
|
9
|
-
Object.defineProperty(exports, "ObjectDiffApplyInvalidStatusException", { enumerable: true, get: function () { return Errors_1.ObjectDiffApplyInvalidStatusException; } });
|
|
10
|
-
Object.defineProperty(exports, "ObjectDiffMergeFailedException", { enumerable: true, get: function () { return Errors_1.ObjectDiffMergeFailedException; } });
|
|
11
|
-
var Language_1 = require("./Language");
|
|
12
|
-
Object.defineProperty(exports, "parseAreaCode", { enumerable: true, get: function () { return Language_1.parseAreaCode; } });
|
|
13
|
-
Object.defineProperty(exports, "parseAreaString", { enumerable: true, get: function () { return Language_1.parseAreaString; } });
|
|
14
|
-
var Log_1 = require("./Log");
|
|
15
|
-
Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return Log_1.Log; } });
|
|
16
|
-
Object.defineProperty(exports, "Performance", { enumerable: true, get: function () { return Log_1.Performance; } });
|
|
17
|
-
//// object
|
|
18
|
-
var Calculater_1 = require("./object/Calculater");
|
|
19
|
-
Object.defineProperty(exports, "ObjectCalculater", { enumerable: true, get: function () { return Calculater_1.ObjectCalculater; } });
|
|
20
|
-
var Helper_1 = require("./object/Helper");
|
|
21
|
-
Object.defineProperty(exports, "ObjectHelper", { enumerable: true, get: function () { return Helper_1.ObjectHelper; } });
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.StringHelper = void 0;
|
|
5
|
-
class StringHelper {
|
|
6
|
-
static format(source, args) {
|
|
7
|
-
if (!args) {
|
|
8
|
-
return source;
|
|
9
|
-
}
|
|
10
|
-
const argument = Array.isArray(args) ? args : [args];
|
|
11
|
-
return source.replace(/('')|\{([0-9]+(?:\s*,[^{}]*)?)\}|[{}]/g, (_match, $1, $2, _$3) => {
|
|
12
|
-
if ($1) {
|
|
13
|
-
return "'";
|
|
14
|
-
}
|
|
15
|
-
else if ($2) {
|
|
16
|
-
return String(argument[parseInt($2, 10)]);
|
|
17
|
-
}
|
|
18
|
-
return "";
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.StringHelper = StringHelper;
|