@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.
Files changed (42) hide show
  1. package/dist/UtilCodecs.d.ts +16 -16
  2. package/dist/UtilCodecs.js +16 -16
  3. package/dist/UtilCom.d.ts +22 -25
  4. package/dist/UtilCom.js +35 -38
  5. package/dist/UtilDecorators.d.ts +15 -8
  6. package/dist/UtilDecorators.js +79 -25
  7. package/dist/UtilFP.d.ts +46 -0
  8. package/dist/UtilFP.js +52 -0
  9. package/dist/UtilFfmpegTools.d.ts +30 -30
  10. package/dist/UtilFfmpegTools.js +32 -32
  11. package/dist/UtilFileTools.d.ts +30 -35
  12. package/dist/UtilFileTools.js +17 -18
  13. package/dist/UtilFunctions.d.ts +37 -78
  14. package/dist/UtilFunctions.js +27 -62
  15. package/dist/UtilInterfaces.d.ts +11 -11
  16. package/dist/UtilInterfaces.js +2 -2
  17. package/dist/UtilLogger.d.ts +55 -55
  18. package/dist/UtilLogger.js +55 -55
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +1 -0
  21. package/dist/test/composeTest.d.ts +21 -0
  22. package/dist/test/composeTest.js +33 -0
  23. package/dist/test/importtest.d.ts +1 -0
  24. package/dist/test/importtest.js +4 -0
  25. package/dist/test/test.js +5 -3
  26. package/package.json +1 -1
  27. package/src/UtilClass.ts +1051 -1051
  28. package/src/UtilCodecs.ts +117 -117
  29. package/src/UtilCom.ts +171 -174
  30. package/src/UtilDecorators.ts +174 -116
  31. package/src/UtilFP.ts +98 -0
  32. package/src/UtilFfmpegTools.ts +271 -271
  33. package/src/UtilFileTools.ts +231 -236
  34. package/src/UtilFunctions.ts +289 -364
  35. package/src/UtilInterfaces.ts +137 -137
  36. package/src/UtilLogger.ts +386 -386
  37. package/src/index.ts +10 -9
  38. package/src/test/composeTest.ts +37 -0
  39. package/src/test/importtest.ts +5 -0
  40. package/src/test/test.ts +8 -6
  41. package/src/test/test2.ts +2 -3
  42. 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
+
@@ -0,0 +1,5 @@
1
+ import { C } from "./composeTest";
2
+
3
+
4
+
5
+ let a:C = C.create();
package/src/test/test.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { UtilFunc } from "../UtilFunctions";
2
- import { ComposedClassMult, ComposedPartClass, ComposedPartClassMult, FixedLengthTuple, FuncPropNames } from "../UtilInterfaces";
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.composePartClass(tb, new A(), ...compKeys);
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 = ComposedPartClass<B, A, typeof compKeys[number]>;
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.mapObject(ed,(k,v)=> v ? v / BASE_MAX[k] : 0 );
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 = UtilFunc.pipeline(Pointify,Sump);
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 { globSync } from "glob";
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
- "DataController": ["./src/DataController"],
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"],