light-h5-core-lib 2.5.1 → 2.5.2
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/LightCore.js +8 -8
- package/package.json +6 -6
- package/type/index.d.ts +36 -16
package/LightCore.js
CHANGED
|
@@ -6,14 +6,14 @@ import { FloatDigitUtil as coreFloatDigitUtil } from "./common/util/FloatDigitUt
|
|
|
6
6
|
import { RandomNumUtil as coreRandomNumUtil } from "./common/util/RandomNumUtil";
|
|
7
7
|
import { StringUtil as coreStringUtil } from "./common/util/StringUtil";
|
|
8
8
|
import { UniqueIDUtil as coreUniqueIDUtil } from "./common/util/UniqueIDUtil";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
module.exports.PoolObj = corePoolObj;
|
|
10
|
+
module.exports.BaseSingleton = coreBaseSingleton;
|
|
11
|
+
module.exports.BitUtil = coreBitUtil;
|
|
12
|
+
module.exports.DateUtil = coreDateUtil;
|
|
13
|
+
module.exports.FloatDigitUtil = coreFloatDigitUtil;
|
|
14
|
+
module.exports.RandomNumUtil = coreRandomNumUtil;
|
|
15
|
+
module.exports.StringUtil = coreStringUtil;
|
|
16
|
+
module.exports.UniqueIDUtil = coreUniqueIDUtil;
|
|
17
17
|
// export { a };
|
|
18
18
|
// export { BaseSingleton };
|
|
19
19
|
// export { BitUtil };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "light-h5-core-lib",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "light core lib",
|
|
5
5
|
"main": "./LightCore.js",
|
|
6
6
|
"types": "./type/index.d.ts",
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"./common/**/*.js",
|
|
11
11
|
"./pool/pool.js"
|
|
12
12
|
],
|
|
13
|
-
"exports":{
|
|
14
|
-
".":{
|
|
15
|
-
"types":{
|
|
16
|
-
"require":"./type/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": {
|
|
16
|
+
"require": "./type/index.d.ts",
|
|
17
17
|
"import": "./type/index.d.ts",
|
|
18
18
|
"default": "./type/index.d.ts"
|
|
19
19
|
},
|
|
20
|
-
"import":{
|
|
20
|
+
"import": {
|
|
21
21
|
"import": "./LightCore.js",
|
|
22
22
|
"default": "./LightCore.js"
|
|
23
23
|
}
|
package/type/index.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export interface IDestroy {
|
|
|
6
6
|
export interface IClear extends IDestroy {
|
|
7
7
|
clear(): void;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* 对象池(泛型)
|
|
11
|
+
* @author aonaufly
|
|
12
|
+
*/
|
|
9
13
|
declare class PoolObj<T> implements IClear {
|
|
10
14
|
private _pool;
|
|
11
15
|
private _cup;
|
|
@@ -35,6 +39,10 @@ declare class BaseSingleton<T> {
|
|
|
35
39
|
new (): T;
|
|
36
40
|
}): T;
|
|
37
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* 位操作工具(从右向左←)
|
|
44
|
+
* @author aonaufly
|
|
45
|
+
*/
|
|
38
46
|
declare class BitUtil {
|
|
39
47
|
/**
|
|
40
48
|
* 读取uint类型某位的值, bit从1开始
|
|
@@ -48,6 +56,10 @@ declare class BitUtil {
|
|
|
48
56
|
/**获取1的个数 */
|
|
49
57
|
static get1num(value: number): number;
|
|
50
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* 日期(时间)工具
|
|
61
|
+
* @author aonaufly
|
|
62
|
+
*/
|
|
51
63
|
declare class DateUtil {
|
|
52
64
|
/**
|
|
53
65
|
* 获取指定时间的时间戳 (单位:ms)
|
|
@@ -90,6 +102,10 @@ declare class DateUtil {
|
|
|
90
102
|
*/
|
|
91
103
|
static getTodayAppointTimeStamp(nowSecond: number, hour: number, minute?: number, second?: number, millisecond?: number): number;
|
|
92
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Float精度
|
|
107
|
+
* @author aonaufly
|
|
108
|
+
*/
|
|
93
109
|
declare class FloatDigitUtil {
|
|
94
110
|
/**
|
|
95
111
|
* 确定小数的精度<b style="color:red">2个小数相加会有精度错误</b>
|
|
@@ -98,6 +114,10 @@ declare class FloatDigitUtil {
|
|
|
98
114
|
*/
|
|
99
115
|
static formatFloat(fNum: number, digit: number): number;
|
|
100
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* 随机数生成工具
|
|
119
|
+
* @author aonaufly
|
|
120
|
+
*/
|
|
101
121
|
declare class RandomNumUtil {
|
|
102
122
|
/**
|
|
103
123
|
* 获取一定方位的随机整数
|
|
@@ -110,6 +130,10 @@ declare class RandomNumUtil {
|
|
|
110
130
|
*/
|
|
111
131
|
static randomNumBoth(min: number, max: number, isInt?: boolean): number;
|
|
112
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* 字符串工具
|
|
135
|
+
* @author aonaufly
|
|
136
|
+
*/
|
|
113
137
|
declare class StringUtil {
|
|
114
138
|
/**
|
|
115
139
|
* 字符串的格式化 , 使用 {index = 0}的模式
|
|
@@ -125,30 +149,26 @@ declare class StringUtil {
|
|
|
125
149
|
static string2UTF8Buffer(str: string): ArrayBuffer;
|
|
126
150
|
static buffer2UTF8String: (buffer: ArrayBuffer) => string;
|
|
127
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* 唯一ID生成器
|
|
154
|
+
* @author Aonaufly
|
|
155
|
+
*/
|
|
128
156
|
declare class UniqueIDUtil {
|
|
129
157
|
/**生成唯一ID值*/
|
|
130
158
|
static getUniqueId(): string;
|
|
131
159
|
/**生成复合的Key值*/
|
|
132
160
|
static getCompositeKey(key: string | number, uniqueId: string): string;
|
|
133
161
|
}
|
|
134
|
-
declare const PoolObj$1: typeof PoolObj;
|
|
135
|
-
declare const BaseSingleton$1: typeof BaseSingleton;
|
|
136
|
-
declare const BitUtil$1: typeof BitUtil;
|
|
137
|
-
declare const DateUtil$1: typeof DateUtil;
|
|
138
|
-
declare const FloatDigitUtil$1: typeof FloatDigitUtil;
|
|
139
|
-
declare const RandomNumUtil$1: typeof RandomNumUtil;
|
|
140
|
-
declare const StringUtil$1: typeof StringUtil;
|
|
141
|
-
declare const UniqueIDUtil$1: typeof UniqueIDUtil;
|
|
142
162
|
|
|
143
163
|
export {
|
|
144
|
-
BaseSingleton
|
|
145
|
-
BitUtil
|
|
146
|
-
DateUtil
|
|
147
|
-
FloatDigitUtil
|
|
148
|
-
PoolObj
|
|
149
|
-
RandomNumUtil
|
|
150
|
-
StringUtil
|
|
151
|
-
UniqueIDUtil
|
|
164
|
+
BaseSingleton as coreBaseSingleton,
|
|
165
|
+
BitUtil as coreBitUtil,
|
|
166
|
+
DateUtil as coreDateUtil,
|
|
167
|
+
FloatDigitUtil as coreFloatDigitUtil,
|
|
168
|
+
PoolObj as corePoolObj,
|
|
169
|
+
RandomNumUtil as coreRandomNumUtil,
|
|
170
|
+
StringUtil as coreStringUtil,
|
|
171
|
+
UniqueIDUtil as coreUniqueIDUtil,
|
|
152
172
|
};
|
|
153
173
|
|
|
154
174
|
export {};
|