@zwa73/utils 1.0.60 → 1.0.61
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/UtilCodecs.d.ts +16 -16
- package/dist/UtilCodecs.js +16 -16
- package/dist/UtilCom.d.ts +22 -25
- package/dist/UtilCom.js +35 -38
- package/dist/UtilDecorators.d.ts +15 -8
- package/dist/UtilDecorators.js +79 -25
- package/dist/UtilFP.d.ts +46 -0
- package/dist/UtilFP.js +52 -0
- package/dist/UtilFfmpegTools.d.ts +30 -30
- package/dist/UtilFfmpegTools.js +32 -32
- package/dist/UtilFileTools.d.ts +30 -35
- package/dist/UtilFileTools.js +17 -18
- package/dist/UtilFunctions.d.ts +37 -78
- package/dist/UtilFunctions.js +27 -62
- package/dist/UtilInterfaces.d.ts +11 -11
- package/dist/UtilInterfaces.js +2 -2
- package/dist/UtilLogger.d.ts +55 -55
- package/dist/UtilLogger.js +55 -55
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/test/composeTest.d.ts +21 -0
- package/dist/test/composeTest.js +33 -0
- package/dist/test/importtest.d.ts +1 -0
- package/dist/test/importtest.js +4 -0
- package/dist/test/test.js +5 -3
- package/package.json +1 -1
- package/src/UtilClass.ts +1051 -1051
- package/src/UtilCodecs.ts +117 -117
- package/src/UtilCom.ts +171 -174
- package/src/UtilDecorators.ts +174 -116
- package/src/UtilFP.ts +98 -0
- package/src/UtilFfmpegTools.ts +271 -271
- package/src/UtilFileTools.ts +231 -236
- package/src/UtilFunctions.ts +289 -364
- package/src/UtilInterfaces.ts +137 -137
- package/src/UtilLogger.ts +386 -386
- package/src/index.ts +10 -9
- package/src/test/composeTest.ts +37 -0
- package/src/test/importtest.ts +5 -0
- package/src/test/test.ts +8 -6
- package/src/test/test2.ts +2 -3
- package/tsconfig.json +2 -7
package/src/index.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export * from './UtilFunctions';
|
|
2
|
-
export * from './UtilInterfaces';
|
|
3
|
-
export * from './UtilClass';
|
|
4
|
-
export * from './UtilCom';
|
|
5
|
-
export * from './UtilCodecs';
|
|
6
|
-
export * from './UtilFfmpegTools';
|
|
7
|
-
export * from './UtilDecorators';
|
|
8
|
-
export * from './UtilFileTools';
|
|
9
|
-
export * from './UtilLogger';
|
|
1
|
+
export * from './UtilFunctions';
|
|
2
|
+
export * from './UtilInterfaces';
|
|
3
|
+
export * from './UtilClass';
|
|
4
|
+
export * from './UtilCom';
|
|
5
|
+
export * from './UtilCodecs';
|
|
6
|
+
export * from './UtilFfmpegTools';
|
|
7
|
+
export * from './UtilDecorators';
|
|
8
|
+
export * from './UtilFileTools';
|
|
9
|
+
export * from './UtilLogger';
|
|
10
|
+
export * from './UtilFP';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { UtilFP, UtilFunc } from ".."
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class A {
|
|
8
|
+
private num = 1;
|
|
9
|
+
getNum = ()=>this.num;
|
|
10
|
+
/**A的函数 */
|
|
11
|
+
getA=()=>this;
|
|
12
|
+
}
|
|
13
|
+
class B {
|
|
14
|
+
private text = "B的text";
|
|
15
|
+
getText = ()=>this.text;
|
|
16
|
+
/**B的函数 */
|
|
17
|
+
getB = ()=> this;
|
|
18
|
+
/**B的静态函数 */
|
|
19
|
+
static getNewB = ()=>new B();
|
|
20
|
+
/**保留的函数 */
|
|
21
|
+
privateFunc(){}
|
|
22
|
+
}
|
|
23
|
+
export const C = UtilFunc.composeClassPart({
|
|
24
|
+
create(){
|
|
25
|
+
let o1 = UtilFunc.composeClassPart(new A(),new B(),'getB','getText');
|
|
26
|
+
let o2 = UtilFP.bindTo('bindFunc',()=>"这是动态绑定的函数",o1);
|
|
27
|
+
return o2;
|
|
28
|
+
}
|
|
29
|
+
},B,'getNewB');
|
|
30
|
+
export type C = ReturnType<typeof C.create>;
|
|
31
|
+
const insc:C=C.create();//?
|
|
32
|
+
C.getNewB().getB().getText()//?
|
|
33
|
+
insc.getText();//?
|
|
34
|
+
insc.getB().getText()//?
|
|
35
|
+
insc.getNum()//?
|
|
36
|
+
insc.bindFunc()//?
|
|
37
|
+
|
package/src/test/test.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { UtilFP } from "@src/UtilFP";
|
|
2
|
+
import { UtilFunc } from "@src/UtilFunctions";
|
|
3
|
+
import { ComposedClassMult, ComposedClassPart, ComposedPartClassMult, FixedLengthTuple, FuncPropNames } from "@src/UtilInterfaces";
|
|
3
4
|
|
|
4
5
|
const compKeys = ["getData","getA"] as const;
|
|
5
6
|
|
|
@@ -33,7 +34,7 @@ class B{
|
|
|
33
34
|
private _bc:BComp;
|
|
34
35
|
private constructor(){
|
|
35
36
|
const tb:B = this;
|
|
36
|
-
this._bc = UtilFunc.
|
|
37
|
+
this._bc = UtilFunc.composeClassPart(tb, new A(), ...compKeys);
|
|
37
38
|
}
|
|
38
39
|
static init(){
|
|
39
40
|
return new B()._bc;
|
|
@@ -42,7 +43,7 @@ class B{
|
|
|
42
43
|
getData1(){return "BGetdata"}
|
|
43
44
|
getTest(){return this._bc.getData()}
|
|
44
45
|
}
|
|
45
|
-
type BComp =
|
|
46
|
+
type BComp = ComposedClassPart<B, A, typeof compKeys[number]>;
|
|
46
47
|
const BComp = {
|
|
47
48
|
init(){
|
|
48
49
|
return B.init();
|
|
@@ -129,9 +130,9 @@ const 精调后 = [
|
|
|
129
130
|
{ 攻击 : 42, 生命: 54 , 防御: 0 , 暴击: 0 , 暴击伤害: 0 , 攻击加成: 6.2, 生命加成: 0, 防御加成: 0 } , // 机枪 双重对策 折叠脚架
|
|
130
131
|
] as const;
|
|
131
132
|
const Pointify = (ed:ExtData)=>
|
|
132
|
-
UtilFunc.
|
|
133
|
+
UtilFunc.mapEntries(ed,(k,v)=> v ? v / BASE_MAX[k] : 0 );
|
|
133
134
|
const Sump = (ed:ExtData)=> Object.values(ed).reduce((r,v)=>r+v);
|
|
134
|
-
const pipeFunc =
|
|
135
|
+
const pipeFunc = UtilFP.flow(Pointify,Sump);
|
|
135
136
|
const Display = (list:number[])=>list.reduce((r,v)=>`${r}\t${v.toFixed(2)}`,"").trim();
|
|
136
137
|
const pre = 精调前.map((v)=>pipeFunc(v));
|
|
137
138
|
const aft = 精调后.map((v)=>pipeFunc(v));
|
|
@@ -221,3 +222,4 @@ for(let k in testa)
|
|
|
221
222
|
testkeys.push(k)
|
|
222
223
|
testkeys//?
|
|
223
224
|
|
|
225
|
+
const a = "123";
|
package/src/test/test2.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import {
|
|
4
|
-
import { UtilFT } from "../UtilFileTools";
|
|
3
|
+
import { UtilFT } from "@src/UtilFileTools";
|
|
5
4
|
|
|
6
5
|
// 将字符串转换为十六进制
|
|
7
6
|
function stringToHex(str:string) {
|
|
@@ -37,4 +36,4 @@ hexToString("556E6974794653")//?
|
|
|
37
36
|
path.parse("123.bs").name;//?
|
|
38
37
|
|
|
39
38
|
let filepath = "F:\\Sosarciel\\SosarcielCore\\NodeJs\\utils\\src"
|
|
40
|
-
UtilFT.fileSearchGlob(`${filepath}/**/*.ts`,"**/test/**/*.ts");//?
|
|
39
|
+
UtilFT.fileSearchGlob(`${filepath}/**/*.ts`,"**/test/**/*.ts");//?
|
package/tsconfig.json
CHANGED
|
@@ -10,13 +10,8 @@
|
|
|
10
10
|
"emitDecoratorMetadata": true,
|
|
11
11
|
"experimentalDecorators": true,
|
|
12
12
|
"paths": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"LaMAdapter": ["./src/LaMAdapter"],
|
|
16
|
-
"TranslationAdapter": ["./src/TranslationAdapter"],
|
|
17
|
-
"Utils": ["./src/Utils"],
|
|
18
|
-
"LaMChar": ["./src/LaMChar"],
|
|
19
|
-
"TTSAdapter": ["./src/TTSAdapter"]
|
|
13
|
+
"@src/*": ["./src/*"],
|
|
14
|
+
"@*" : ["./*"]
|
|
20
15
|
}
|
|
21
16
|
},
|
|
22
17
|
"include": ["./src/**/*.ts", "./src/**/*.js"],
|