@aitianyu.cn/types 0.0.11 → 0.0.13
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/index.js +54 -54
- 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 +138 -138
- package/dist/lib/types/Types.js +3 -3
- package/dist/lib/types/index.js +17 -17
- package/dist/lib/utilities/coding/Error.js +44 -44
- package/dist/lib/utilities/coding/Path.js +198 -198
- package/dist/lib/utilities/coding/index.js +10 -10
- package/dist/lib/utilities/core/Errors.js +86 -86
- package/dist/lib/utilities/core/Language.js +559 -559
- package/dist/lib/utilities/core/Log.js +108 -108
- package/dist/lib/utilities/core/TypeConvertion.js +25 -25
- package/dist/lib/utilities/core/index.js +21 -21
- package/dist/lib/utilities/core/interface/ITJSON.js +3 -0
- package/dist/lib/utilities/core/interface/ITianyuType.js +3 -0
- package/dist/lib/utilities/core/object/ArrayHelper.js +35 -35
- package/dist/lib/utilities/core/object/Calculater.js +230 -230
- package/dist/lib/utilities/core/object/Helper.js +201 -201
- package/dist/lib/utilities/core/object/StringHelper.js +22 -22
- package/dist/lib/utilities/core/type/TArray.js +7 -0
- package/dist/lib/utilities/core/type/TBoolean.js +7 -0
- package/dist/lib/utilities/core/type/TJSON.js +7 -0
- package/dist/lib/utilities/core/type/TNumber.js +7 -0
- package/dist/lib/utilities/core/type/TObject.js +7 -0
- package/dist/lib/utilities/core/type/TString.js +7 -0
- package/dist/lib/utilities/security/Guid.js +20 -20
- package/dist/lib/utilities/security/Hash.js +15 -15
- package/dist/lib/utilities/security/index.js +8 -8
- package/dist/types/index.d.ts +21 -21
- 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 -20
- package/dist/types/types/index.d.ts +9 -9
- package/dist/types/utilities/coding/Error.d.ts +27 -27
- package/dist/types/utilities/coding/Path.d.ts +61 -61
- package/dist/types/utilities/coding/index.d.ts +3 -3
- package/dist/types/utilities/core/Errors.d.ts +47 -47
- package/dist/types/utilities/core/Language.d.ts +17 -17
- package/dist/types/utilities/core/Log.d.ts +12 -12
- package/dist/types/utilities/core/TypeConvertion.d.ts +2 -2
- package/dist/types/utilities/core/index.d.ts +6 -6
- package/dist/types/utilities/core/interface/ITJSON.d.ts +5 -0
- package/dist/types/utilities/core/interface/ITianyuType.d.ts +5 -0
- package/dist/types/utilities/core/object/ArrayHelper.d.ts +11 -11
- package/dist/types/utilities/core/object/Calculater.d.ts +22 -22
- package/dist/types/utilities/core/object/Helper.d.ts +39 -39
- package/dist/types/utilities/core/object/StringHelper.d.ts +4 -4
- package/dist/types/utilities/core/type/TArray.d.ts +3 -0
- package/dist/types/utilities/core/type/TBoolean.d.ts +3 -0
- package/dist/types/utilities/core/type/TJSON.d.ts +3 -0
- package/dist/types/utilities/core/type/TNumber.d.ts +3 -0
- package/dist/types/utilities/core/type/TObject.d.ts +3 -0
- package/dist/types/utilities/core/type/TString.d.ts +3 -0
- package/dist/types/utilities/security/Guid.d.ts +3 -3
- package/dist/types/utilities/security/Hash.d.ts +3 -3
- package/dist/types/utilities/security/index.d.ts +3 -3
- package/package.json +51 -51
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.PathBase = void 0;
|
|
5
|
-
/** Path base class */
|
|
6
|
-
class PathBase {
|
|
7
|
-
_dirs;
|
|
8
|
-
/**
|
|
9
|
-
* Create a Path instance by specified dirs
|
|
10
|
-
*
|
|
11
|
-
* @param dirs the specified directories
|
|
12
|
-
*/
|
|
13
|
-
constructor(dirs) {
|
|
14
|
-
this._dirs = (dirs && [...dirs]) || [];
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Convert the path instance to string
|
|
18
|
-
*
|
|
19
|
-
* @returns return the fromatted string
|
|
20
|
-
*/
|
|
21
|
-
toString() {
|
|
22
|
-
if (0 === this._dirs.length) {
|
|
23
|
-
return "";
|
|
24
|
-
}
|
|
25
|
-
return this._dirs.join("/");
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Iterator of path directories
|
|
29
|
-
*
|
|
30
|
-
* @returns return an iterator
|
|
31
|
-
*/
|
|
32
|
-
[Symbol.iterator]() {
|
|
33
|
-
let index = 0;
|
|
34
|
-
return {
|
|
35
|
-
next: () => {
|
|
36
|
-
if (index < this._dirs.length) {
|
|
37
|
-
return { done: false, value: this._dirs[index++] };
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
return { done: true, value: "" };
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Get a directories array deep copy
|
|
47
|
-
*
|
|
48
|
-
* @returns return directories
|
|
49
|
-
*/
|
|
50
|
-
getDirs() {
|
|
51
|
-
return this._dirs.concat();
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Get a number that indicates the directories count
|
|
55
|
-
*
|
|
56
|
-
* @returns return the directories count
|
|
57
|
-
*/
|
|
58
|
-
length() {
|
|
59
|
-
return this._dirs.length;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Append a new directory to the end of path
|
|
63
|
-
*
|
|
64
|
-
* @param dir the new directory name
|
|
65
|
-
* @returns return the new directories count
|
|
66
|
-
*/
|
|
67
|
-
append(dir) {
|
|
68
|
-
return this._dirs.push(dir);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Clean all the pathes
|
|
72
|
-
*/
|
|
73
|
-
clear() {
|
|
74
|
-
this._dirs = [];
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Remove the end directory of the path instance and return it
|
|
78
|
-
*
|
|
79
|
-
* @returns return the end of directory
|
|
80
|
-
*/
|
|
81
|
-
pop() {
|
|
82
|
-
return this._dirs.pop();
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Remove the first directory of the path instance and return it
|
|
86
|
-
*
|
|
87
|
-
* @returns return the first directory
|
|
88
|
-
*/
|
|
89
|
-
shift() {
|
|
90
|
-
return this._dirs.shift();
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Convert the path instance to string for object comparing
|
|
94
|
-
*
|
|
95
|
-
* @returns return the comparable string
|
|
96
|
-
*/
|
|
97
|
-
getString() {
|
|
98
|
-
return this.toString();
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Get the hashcode of current path
|
|
102
|
-
*
|
|
103
|
-
* @returns always return 0
|
|
104
|
-
*/
|
|
105
|
-
getHashCode() {
|
|
106
|
-
return 0;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
exports.PathBase = PathBase;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**@format */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PathBase = void 0;
|
|
5
|
+
/** Path base class */
|
|
6
|
+
class PathBase {
|
|
7
|
+
_dirs;
|
|
8
|
+
/**
|
|
9
|
+
* Create a Path instance by specified dirs
|
|
10
|
+
*
|
|
11
|
+
* @param dirs the specified directories
|
|
12
|
+
*/
|
|
13
|
+
constructor(dirs) {
|
|
14
|
+
this._dirs = (dirs && [...dirs]) || [];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Convert the path instance to string
|
|
18
|
+
*
|
|
19
|
+
* @returns return the fromatted string
|
|
20
|
+
*/
|
|
21
|
+
toString() {
|
|
22
|
+
if (0 === this._dirs.length) {
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
return this._dirs.join("/");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Iterator of path directories
|
|
29
|
+
*
|
|
30
|
+
* @returns return an iterator
|
|
31
|
+
*/
|
|
32
|
+
[Symbol.iterator]() {
|
|
33
|
+
let index = 0;
|
|
34
|
+
return {
|
|
35
|
+
next: () => {
|
|
36
|
+
if (index < this._dirs.length) {
|
|
37
|
+
return { done: false, value: this._dirs[index++] };
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return { done: true, value: "" };
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get a directories array deep copy
|
|
47
|
+
*
|
|
48
|
+
* @returns return directories
|
|
49
|
+
*/
|
|
50
|
+
getDirs() {
|
|
51
|
+
return this._dirs.concat();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get a number that indicates the directories count
|
|
55
|
+
*
|
|
56
|
+
* @returns return the directories count
|
|
57
|
+
*/
|
|
58
|
+
length() {
|
|
59
|
+
return this._dirs.length;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Append a new directory to the end of path
|
|
63
|
+
*
|
|
64
|
+
* @param dir the new directory name
|
|
65
|
+
* @returns return the new directories count
|
|
66
|
+
*/
|
|
67
|
+
append(dir) {
|
|
68
|
+
return this._dirs.push(dir);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Clean all the pathes
|
|
72
|
+
*/
|
|
73
|
+
clear() {
|
|
74
|
+
this._dirs = [];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Remove the end directory of the path instance and return it
|
|
78
|
+
*
|
|
79
|
+
* @returns return the end of directory
|
|
80
|
+
*/
|
|
81
|
+
pop() {
|
|
82
|
+
return this._dirs.pop();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Remove the first directory of the path instance and return it
|
|
86
|
+
*
|
|
87
|
+
* @returns return the first directory
|
|
88
|
+
*/
|
|
89
|
+
shift() {
|
|
90
|
+
return this._dirs.shift();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Convert the path instance to string for object comparing
|
|
94
|
+
*
|
|
95
|
+
* @returns return the comparable string
|
|
96
|
+
*/
|
|
97
|
+
getString() {
|
|
98
|
+
return this.toString();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get the hashcode of current path
|
|
102
|
+
*
|
|
103
|
+
* @returns always return 0
|
|
104
|
+
*/
|
|
105
|
+
getHashCode() {
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.PathBase = PathBase;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.EncryptOption = void 0;
|
|
5
|
-
/** Encrypt Option Type */
|
|
6
|
-
var EncryptOption;
|
|
7
|
-
(function (EncryptOption) {
|
|
8
|
-
EncryptOption[EncryptOption["Encryption"] = 0] = "Encryption";
|
|
9
|
-
EncryptOption[EncryptOption["Decryption"] = 1] = "Decryption";
|
|
10
|
-
})(EncryptOption = exports.EncryptOption || (exports.EncryptOption = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
/**@format */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.EncryptOption = void 0;
|
|
5
|
+
/** Encrypt Option Type */
|
|
6
|
+
var EncryptOption;
|
|
7
|
+
(function (EncryptOption) {
|
|
8
|
+
EncryptOption[EncryptOption["Encryption"] = 0] = "Encryption";
|
|
9
|
+
EncryptOption[EncryptOption["Decryption"] = 1] = "Decryption";
|
|
10
|
+
})(EncryptOption = exports.EncryptOption || (exports.EncryptOption = {}));
|
package/dist/lib/types/TMap.js
CHANGED
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.TMap = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* Tianyu Map
|
|
7
|
-
* Support Customized Object type
|
|
8
|
-
*/
|
|
9
|
-
class TMap {
|
|
10
|
-
_map;
|
|
11
|
-
_kMap;
|
|
12
|
-
/**
|
|
13
|
-
* Create an empty Tianyu Map Instance
|
|
14
|
-
*/
|
|
15
|
-
constructor() {
|
|
16
|
-
this._map = new Map();
|
|
17
|
-
this._kMap = new Map();
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Clean the Map instance
|
|
21
|
-
*/
|
|
22
|
-
clear() {
|
|
23
|
-
this._map.clear();
|
|
24
|
-
this._kMap.clear();
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Delete a specified item from the instance
|
|
28
|
-
*
|
|
29
|
-
* @param key The key of the item
|
|
30
|
-
* @returns return true if deleted successful and return false if failed
|
|
31
|
-
*/
|
|
32
|
-
delete(key) {
|
|
33
|
-
const keyString = key.getString();
|
|
34
|
-
return this._map.delete(keyString) && this._kMap.delete(keyString);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Executes a provided function once per each key/value pair in the Map, in insertion order.
|
|
38
|
-
*
|
|
39
|
-
* @param callbackfn provided execution function
|
|
40
|
-
* @param thisArg additional args
|
|
41
|
-
*/
|
|
42
|
-
forEach(callbackfn, thisArg) {
|
|
43
|
-
const runMap = new Map();
|
|
44
|
-
this._map.forEach((value, key, map) => {
|
|
45
|
-
const keyObj = this._kMap.get(key);
|
|
46
|
-
if (!!!keyObj) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
runMap.set(keyObj, value);
|
|
50
|
-
callbackfn(value, keyObj, runMap);
|
|
51
|
-
}, thisArg);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Returns a specified element from the Map object. If the value that is associated to the provided key is an object,
|
|
55
|
-
* then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
|
|
56
|
-
*
|
|
57
|
-
* @param key The key of the value
|
|
58
|
-
* @returns Returns the element associated with the specified key.
|
|
59
|
-
* If no element is associated with the specified key, undefined is returned.
|
|
60
|
-
*/
|
|
61
|
-
get(key) {
|
|
62
|
-
const keyString = key.getString();
|
|
63
|
-
return this._map.get(keyString);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Get a boolean value indicates whether an element with the specified key exists or not.
|
|
67
|
-
*
|
|
68
|
-
* @param key The key what wants to search
|
|
69
|
-
* @returns return true if the value is found
|
|
70
|
-
*/
|
|
71
|
-
has(key) {
|
|
72
|
-
const keyString = key.getString();
|
|
73
|
-
return this._kMap.has(keyString);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* 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.
|
|
77
|
-
*
|
|
78
|
-
* @param key The key of new element
|
|
79
|
-
* @param value The value of new element
|
|
80
|
-
* @returns return the instance that is current instance
|
|
81
|
-
*/
|
|
82
|
-
set(key, value) {
|
|
83
|
-
const keyString = key.getString();
|
|
84
|
-
this._map.set(keyString, value);
|
|
85
|
-
this._kMap.set(keyString, key);
|
|
86
|
-
return this;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Get a number of elements in the Map
|
|
90
|
-
*
|
|
91
|
-
* @returns return the count of elements
|
|
92
|
-
*/
|
|
93
|
-
size() {
|
|
94
|
-
return this._kMap.size;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Get all keys of the Map
|
|
98
|
-
*
|
|
99
|
-
* @returns return a keys iterator
|
|
100
|
-
*/
|
|
101
|
-
keys() {
|
|
102
|
-
return this._kMap.values();
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Get all values of the Map
|
|
106
|
-
*
|
|
107
|
-
* @returns return a values iterator
|
|
108
|
-
*/
|
|
109
|
-
values() {
|
|
110
|
-
return this._map.values();
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Get an Iterator of the Map
|
|
114
|
-
*
|
|
115
|
-
* @returns return an iterator object
|
|
116
|
-
*/
|
|
117
|
-
[Symbol.iterator]() {
|
|
118
|
-
const keys = this._map.entries();
|
|
119
|
-
const iteratorObj = {
|
|
120
|
-
next: () => {
|
|
121
|
-
const keyNext = keys.next();
|
|
122
|
-
if (keyNext.done) {
|
|
123
|
-
return {
|
|
124
|
-
done: true,
|
|
125
|
-
value: [undefined, undefined],
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
const value = [this._kMap.get(keyNext.value[0]), keyNext.value[1]];
|
|
129
|
-
return {
|
|
130
|
-
done: false,
|
|
131
|
-
value: value,
|
|
132
|
-
};
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
return iteratorObj;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
exports.TMap = TMap;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**@format */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TMap = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Tianyu Map
|
|
7
|
+
* Support Customized Object type
|
|
8
|
+
*/
|
|
9
|
+
class TMap {
|
|
10
|
+
_map;
|
|
11
|
+
_kMap;
|
|
12
|
+
/**
|
|
13
|
+
* Create an empty Tianyu Map Instance
|
|
14
|
+
*/
|
|
15
|
+
constructor() {
|
|
16
|
+
this._map = new Map();
|
|
17
|
+
this._kMap = new Map();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Clean the Map instance
|
|
21
|
+
*/
|
|
22
|
+
clear() {
|
|
23
|
+
this._map.clear();
|
|
24
|
+
this._kMap.clear();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Delete a specified item from the instance
|
|
28
|
+
*
|
|
29
|
+
* @param key The key of the item
|
|
30
|
+
* @returns return true if deleted successful and return false if failed
|
|
31
|
+
*/
|
|
32
|
+
delete(key) {
|
|
33
|
+
const keyString = key.getString();
|
|
34
|
+
return this._map.delete(keyString) && this._kMap.delete(keyString);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Executes a provided function once per each key/value pair in the Map, in insertion order.
|
|
38
|
+
*
|
|
39
|
+
* @param callbackfn provided execution function
|
|
40
|
+
* @param thisArg additional args
|
|
41
|
+
*/
|
|
42
|
+
forEach(callbackfn, thisArg) {
|
|
43
|
+
const runMap = new Map();
|
|
44
|
+
this._map.forEach((value, key, map) => {
|
|
45
|
+
const keyObj = this._kMap.get(key);
|
|
46
|
+
if (!!!keyObj) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
runMap.set(keyObj, value);
|
|
50
|
+
callbackfn(value, keyObj, runMap);
|
|
51
|
+
}, thisArg);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns a specified element from the Map object. If the value that is associated to the provided key is an object,
|
|
55
|
+
* then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
|
|
56
|
+
*
|
|
57
|
+
* @param key The key of the value
|
|
58
|
+
* @returns Returns the element associated with the specified key.
|
|
59
|
+
* If no element is associated with the specified key, undefined is returned.
|
|
60
|
+
*/
|
|
61
|
+
get(key) {
|
|
62
|
+
const keyString = key.getString();
|
|
63
|
+
return this._map.get(keyString);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get a boolean value indicates whether an element with the specified key exists or not.
|
|
67
|
+
*
|
|
68
|
+
* @param key The key what wants to search
|
|
69
|
+
* @returns return true if the value is found
|
|
70
|
+
*/
|
|
71
|
+
has(key) {
|
|
72
|
+
const keyString = key.getString();
|
|
73
|
+
return this._kMap.has(keyString);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 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.
|
|
77
|
+
*
|
|
78
|
+
* @param key The key of new element
|
|
79
|
+
* @param value The value of new element
|
|
80
|
+
* @returns return the instance that is current instance
|
|
81
|
+
*/
|
|
82
|
+
set(key, value) {
|
|
83
|
+
const keyString = key.getString();
|
|
84
|
+
this._map.set(keyString, value);
|
|
85
|
+
this._kMap.set(keyString, key);
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get a number of elements in the Map
|
|
90
|
+
*
|
|
91
|
+
* @returns return the count of elements
|
|
92
|
+
*/
|
|
93
|
+
size() {
|
|
94
|
+
return this._kMap.size;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get all keys of the Map
|
|
98
|
+
*
|
|
99
|
+
* @returns return a keys iterator
|
|
100
|
+
*/
|
|
101
|
+
keys() {
|
|
102
|
+
return this._kMap.values();
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get all values of the Map
|
|
106
|
+
*
|
|
107
|
+
* @returns return a values iterator
|
|
108
|
+
*/
|
|
109
|
+
values() {
|
|
110
|
+
return this._map.values();
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get an Iterator of the Map
|
|
114
|
+
*
|
|
115
|
+
* @returns return an iterator object
|
|
116
|
+
*/
|
|
117
|
+
[Symbol.iterator]() {
|
|
118
|
+
const keys = this._map.entries();
|
|
119
|
+
const iteratorObj = {
|
|
120
|
+
next: () => {
|
|
121
|
+
const keyNext = keys.next();
|
|
122
|
+
if (keyNext.done) {
|
|
123
|
+
return {
|
|
124
|
+
done: true,
|
|
125
|
+
value: [undefined, undefined],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const value = [this._kMap.get(keyNext.value[0]), keyNext.value[1]];
|
|
129
|
+
return {
|
|
130
|
+
done: false,
|
|
131
|
+
value: value,
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
return iteratorObj;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.TMap = TMap;
|
package/dist/lib/types/Types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
/**@format */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/lib/types/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.TMap = exports.EncryptOption = exports.PathBase = exports.LogLevel = exports.Exception = exports.AreaCode = void 0;
|
|
5
|
-
// src
|
|
6
|
-
var AreaCode_1 = require("./AreaCode");
|
|
7
|
-
Object.defineProperty(exports, "AreaCode", { enumerable: true, get: function () { return AreaCode_1.AreaCode; } });
|
|
8
|
-
var Exception_1 = require("./Exception");
|
|
9
|
-
Object.defineProperty(exports, "Exception", { enumerable: true, get: function () { return Exception_1.Exception; } });
|
|
10
|
-
var Logs_1 = require("./Logs");
|
|
11
|
-
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return Logs_1.LogLevel; } });
|
|
12
|
-
var PathBase_1 = require("./PathBase");
|
|
13
|
-
Object.defineProperty(exports, "PathBase", { enumerable: true, get: function () { return PathBase_1.PathBase; } });
|
|
14
|
-
var Security_1 = require("./Security");
|
|
15
|
-
Object.defineProperty(exports, "EncryptOption", { enumerable: true, get: function () { return Security_1.EncryptOption; } });
|
|
16
|
-
var TMap_1 = require("./TMap");
|
|
17
|
-
Object.defineProperty(exports, "TMap", { enumerable: true, get: function () { return TMap_1.TMap; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
/**@format */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TMap = exports.EncryptOption = exports.PathBase = exports.LogLevel = exports.Exception = exports.AreaCode = void 0;
|
|
5
|
+
// src
|
|
6
|
+
var AreaCode_1 = require("./AreaCode");
|
|
7
|
+
Object.defineProperty(exports, "AreaCode", { enumerable: true, get: function () { return AreaCode_1.AreaCode; } });
|
|
8
|
+
var Exception_1 = require("./Exception");
|
|
9
|
+
Object.defineProperty(exports, "Exception", { enumerable: true, get: function () { return Exception_1.Exception; } });
|
|
10
|
+
var Logs_1 = require("./Logs");
|
|
11
|
+
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return Logs_1.LogLevel; } });
|
|
12
|
+
var PathBase_1 = require("./PathBase");
|
|
13
|
+
Object.defineProperty(exports, "PathBase", { enumerable: true, get: function () { return PathBase_1.PathBase; } });
|
|
14
|
+
var Security_1 = require("./Security");
|
|
15
|
+
Object.defineProperty(exports, "EncryptOption", { enumerable: true, get: function () { return Security_1.EncryptOption; } });
|
|
16
|
+
var TMap_1 = require("./TMap");
|
|
17
|
+
Object.defineProperty(exports, "TMap", { enumerable: true, get: function () { return TMap_1.TMap; } });
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.PathDirAndFileConvertInvaild = exports.PathDirectoryValidationFailException = exports.PathProcessorSourceLostException = void 0;
|
|
5
|
-
const Exception_1 = require("../../types/Exception");
|
|
6
|
-
/**
|
|
7
|
-
* Source lost exception of Path Processor.
|
|
8
|
-
* Exception will be thrown if the path is file but the file field is not specified
|
|
9
|
-
*/
|
|
10
|
-
class PathProcessorSourceLostException extends Exception_1.Exception {
|
|
11
|
-
constructor(msg) {
|
|
12
|
-
super(msg);
|
|
13
|
-
}
|
|
14
|
-
toString() {
|
|
15
|
-
return `路径处理器 - 指定的参数 ( path.file ) 为空`;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.PathProcessorSourceLostException = PathProcessorSourceLostException;
|
|
19
|
-
/**
|
|
20
|
-
* Path directory name is not valid.
|
|
21
|
-
* Exception will be thrown if the path name has the invalid char
|
|
22
|
-
*/
|
|
23
|
-
class PathDirectoryValidationFailException extends Exception_1.Exception {
|
|
24
|
-
constructor(msg) {
|
|
25
|
-
super(msg);
|
|
26
|
-
}
|
|
27
|
-
toString() {
|
|
28
|
-
return `路径处理器 - 指定的路径目录 ( ${this.message} ) 无效`;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.PathDirectoryValidationFailException = PathDirectoryValidationFailException;
|
|
32
|
-
/**
|
|
33
|
-
* Path is file or directory but target type is not.
|
|
34
|
-
* Exception will be thrown if the path is file(directory) but try to convert to directory(file)
|
|
35
|
-
*/
|
|
36
|
-
class PathDirAndFileConvertInvaild extends Exception_1.Exception {
|
|
37
|
-
constructor(path, type) {
|
|
38
|
-
super(`${path} 为 ${type === "directory" ? "目录" : "文件"}`);
|
|
39
|
-
}
|
|
40
|
-
toString() {
|
|
41
|
-
return `路径处理器 - 不能将文件与目录相互转换 ( ${this.message} ) `;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.PathDirAndFileConvertInvaild = PathDirAndFileConvertInvaild;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**@format */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PathDirAndFileConvertInvaild = exports.PathDirectoryValidationFailException = exports.PathProcessorSourceLostException = void 0;
|
|
5
|
+
const Exception_1 = require("../../types/Exception");
|
|
6
|
+
/**
|
|
7
|
+
* Source lost exception of Path Processor.
|
|
8
|
+
* Exception will be thrown if the path is file but the file field is not specified
|
|
9
|
+
*/
|
|
10
|
+
class PathProcessorSourceLostException extends Exception_1.Exception {
|
|
11
|
+
constructor(msg) {
|
|
12
|
+
super(msg);
|
|
13
|
+
}
|
|
14
|
+
toString() {
|
|
15
|
+
return `路径处理器 - 指定的参数 ( path.file ) 为空`;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.PathProcessorSourceLostException = PathProcessorSourceLostException;
|
|
19
|
+
/**
|
|
20
|
+
* Path directory name is not valid.
|
|
21
|
+
* Exception will be thrown if the path name has the invalid char
|
|
22
|
+
*/
|
|
23
|
+
class PathDirectoryValidationFailException extends Exception_1.Exception {
|
|
24
|
+
constructor(msg) {
|
|
25
|
+
super(msg);
|
|
26
|
+
}
|
|
27
|
+
toString() {
|
|
28
|
+
return `路径处理器 - 指定的路径目录 ( ${this.message} ) 无效`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.PathDirectoryValidationFailException = PathDirectoryValidationFailException;
|
|
32
|
+
/**
|
|
33
|
+
* Path is file or directory but target type is not.
|
|
34
|
+
* Exception will be thrown if the path is file(directory) but try to convert to directory(file)
|
|
35
|
+
*/
|
|
36
|
+
class PathDirAndFileConvertInvaild extends Exception_1.Exception {
|
|
37
|
+
constructor(path, type) {
|
|
38
|
+
super(`${path} 为 ${type === "directory" ? "目录" : "文件"}`);
|
|
39
|
+
}
|
|
40
|
+
toString() {
|
|
41
|
+
return `路径处理器 - 不能将文件与目录相互转换 ( ${this.message} ) `;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.PathDirAndFileConvertInvaild = PathDirAndFileConvertInvaild;
|