@vope/utils 1.4.27 → 1.4.30
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/cjs/index.js +24 -2
- package/lib/memory/basic.js +11 -1
- package/lib/memory/simple.js +7 -1
- package/lib/neo4j-anchors.js +6 -0
- package/package.json +11 -7
- package/types/desens.d.ts +7 -7
- package/types/index.d.ts +1 -1
- package/types/memory/basic.d.ts +5 -1
- package/types/memory/simple.d.ts +6 -1
- package/types/neo4j-anchors.d.ts +5 -0
package/cjs/index.js
CHANGED
|
@@ -5484,6 +5484,16 @@ var MemoryBasic = class {
|
|
|
5484
5484
|
});
|
|
5485
5485
|
return this;
|
|
5486
5486
|
}
|
|
5487
|
+
/**
|
|
5488
|
+
* 返回位于指定索引处的项
|
|
5489
|
+
*/
|
|
5490
|
+
at(index) {
|
|
5491
|
+
const { list } = this;
|
|
5492
|
+
if (index < 0) {
|
|
5493
|
+
index += list.length;
|
|
5494
|
+
}
|
|
5495
|
+
return this.list.at(index);
|
|
5496
|
+
}
|
|
5487
5497
|
/**
|
|
5488
5498
|
* 遍历所有存储数据(按入栈顺序)
|
|
5489
5499
|
*/
|
|
@@ -5521,7 +5531,7 @@ var MemoryBasic = class {
|
|
|
5521
5531
|
return this.list.reduce(callback, initialValue);
|
|
5522
5532
|
}
|
|
5523
5533
|
/**
|
|
5524
|
-
*
|
|
5534
|
+
* 判断存储是否包含指定类型
|
|
5525
5535
|
*/
|
|
5526
5536
|
includes(type) {
|
|
5527
5537
|
return this.memorys.has(type);
|
|
@@ -5664,6 +5674,12 @@ var MemorySimple = class {
|
|
|
5664
5674
|
const key2 = this.#key;
|
|
5665
5675
|
return typeof key2 === "function" ? key2(data) : data[key2];
|
|
5666
5676
|
}
|
|
5677
|
+
/**
|
|
5678
|
+
* 返回位于指定索引处的项
|
|
5679
|
+
*/
|
|
5680
|
+
at(index) {
|
|
5681
|
+
return this.#memory.at(index);
|
|
5682
|
+
}
|
|
5667
5683
|
push(...list) {
|
|
5668
5684
|
const memory = this.#memory;
|
|
5669
5685
|
list.forEach((data) => {
|
|
@@ -5706,7 +5722,7 @@ var MemorySimple = class {
|
|
|
5706
5722
|
return this.#memory.reduce(callback, initialValue);
|
|
5707
5723
|
}
|
|
5708
5724
|
/**
|
|
5709
|
-
*
|
|
5725
|
+
* 判断是否包含指定类型
|
|
5710
5726
|
*/
|
|
5711
5727
|
includes(type) {
|
|
5712
5728
|
return this.#memory.includes(type);
|
|
@@ -5758,6 +5774,12 @@ var Neo4jAhchors = class {
|
|
|
5758
5774
|
[neo4j.targetField]: end
|
|
5759
5775
|
});
|
|
5760
5776
|
}
|
|
5777
|
+
/**
|
|
5778
|
+
* 设置多边间隔弧长
|
|
5779
|
+
*/
|
|
5780
|
+
setRaidx(value) {
|
|
5781
|
+
this.config.radOffsetRaidx = value;
|
|
5782
|
+
}
|
|
5761
5783
|
/**
|
|
5762
5784
|
* 当图数据准备好后调用
|
|
5763
5785
|
*/
|
package/lib/memory/basic.js
CHANGED
|
@@ -34,6 +34,16 @@ class MemoryBasic {
|
|
|
34
34
|
});
|
|
35
35
|
return this;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* 返回位于指定索引处的项
|
|
39
|
+
*/
|
|
40
|
+
at(index) {
|
|
41
|
+
const { list } = this;
|
|
42
|
+
if (index < 0) {
|
|
43
|
+
index += list.length;
|
|
44
|
+
}
|
|
45
|
+
return this.list.at(index);
|
|
46
|
+
}
|
|
37
47
|
/**
|
|
38
48
|
* 遍历所有存储数据(按入栈顺序)
|
|
39
49
|
*/
|
|
@@ -71,7 +81,7 @@ class MemoryBasic {
|
|
|
71
81
|
return this.list.reduce(callback, initialValue);
|
|
72
82
|
}
|
|
73
83
|
/**
|
|
74
|
-
*
|
|
84
|
+
* 判断存储是否包含指定类型
|
|
75
85
|
*/
|
|
76
86
|
includes(type) {
|
|
77
87
|
return this.memorys.has(type);
|
package/lib/memory/simple.js
CHANGED
|
@@ -16,6 +16,12 @@ class MemorySimple {
|
|
|
16
16
|
const key = this.#key;
|
|
17
17
|
return typeof key === "function" ? key(data) : data[key];
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* 返回位于指定索引处的项
|
|
21
|
+
*/
|
|
22
|
+
at(index) {
|
|
23
|
+
return this.#memory.at(index);
|
|
24
|
+
}
|
|
19
25
|
push(...list) {
|
|
20
26
|
const memory = this.#memory;
|
|
21
27
|
list.forEach((data) => {
|
|
@@ -58,7 +64,7 @@ class MemorySimple {
|
|
|
58
64
|
return this.#memory.reduce(callback, initialValue);
|
|
59
65
|
}
|
|
60
66
|
/**
|
|
61
|
-
*
|
|
67
|
+
* 判断是否包含指定类型
|
|
62
68
|
*/
|
|
63
69
|
includes(type) {
|
|
64
70
|
return this.#memory.includes(type);
|
package/lib/neo4j-anchors.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vope/utils",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"mocha": "mocha __tests/**/*.js",
|
|
20
20
|
"test": "npm run mocha",
|
|
21
21
|
"prepublishOnly": "npm run build & npm run test",
|
|
22
|
-
"debug": "npm run
|
|
22
|
+
"debug": "npm run start & npm run premocha"
|
|
23
23
|
},
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
@@ -29,21 +29,25 @@
|
|
|
29
29
|
},
|
|
30
30
|
"author": "vope",
|
|
31
31
|
"license": "ISC",
|
|
32
|
+
"sideEffects": [
|
|
33
|
+
"lib/storage/offline.js",
|
|
34
|
+
"src/storage/offline.ts"
|
|
35
|
+
],
|
|
32
36
|
"files": [
|
|
33
37
|
"cjs",
|
|
34
38
|
"lib",
|
|
35
39
|
"types"
|
|
36
40
|
],
|
|
37
41
|
"devDependencies": {
|
|
38
|
-
"@babel/parser": "^7.
|
|
39
|
-
"@babel/traverse": "^7.
|
|
40
|
-
"@babel/types": "^7.
|
|
42
|
+
"@babel/parser": "^7.26.5",
|
|
43
|
+
"@babel/traverse": "^7.26.5",
|
|
44
|
+
"@babel/types": "^7.26.5",
|
|
41
45
|
"@rollup/plugin-alias": "^5.1.1",
|
|
42
46
|
"@rollup/plugin-commonjs": "^28.0.0",
|
|
43
47
|
"@rollup/plugin-json": "^6.1.0",
|
|
44
48
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
45
49
|
"@rollup/plugin-typescript": "^12.1.0",
|
|
46
|
-
"@types/babel__traverse": "^7.20.
|
|
50
|
+
"@types/babel__traverse": "^7.20.6",
|
|
47
51
|
"@types/mocha": "^10.0.6",
|
|
48
52
|
"@types/node": "^20.4.5",
|
|
49
53
|
"@types/sm-crypto": "^0.3.4",
|
|
@@ -53,7 +57,7 @@
|
|
|
53
57
|
"mocha": "^10.2.0",
|
|
54
58
|
"puppeteer": "^23.4.1",
|
|
55
59
|
"rimraf": "^5.0.5",
|
|
56
|
-
"rollup": "^4.
|
|
60
|
+
"rollup": "^4.34.6",
|
|
57
61
|
"tslib": "^2.6.1",
|
|
58
62
|
"typescript": "^5.3.3"
|
|
59
63
|
},
|
package/types/desens.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ interface Rule {
|
|
|
2
2
|
/** 加密的开始(包含)和结束(包含)位置(位置信息基于明文) */
|
|
3
3
|
range: [number, number];
|
|
4
4
|
}
|
|
5
|
-
interface
|
|
5
|
+
export interface DesensDecrypt extends Rule {
|
|
6
6
|
/** 密文长度 */
|
|
7
7
|
modify: number;
|
|
8
8
|
}
|
|
9
|
-
interface
|
|
9
|
+
export interface DesensEncrypt extends Rule {
|
|
10
10
|
/** 密文 */
|
|
11
11
|
ciphertext: string;
|
|
12
12
|
}
|
|
@@ -16,17 +16,17 @@ interface EncryptRule extends Rule {
|
|
|
16
16
|
* @param encrypt 加密方法
|
|
17
17
|
* @returns 解密要素
|
|
18
18
|
*/
|
|
19
|
-
export declare const desensEncrypt: (plaintext: string, encrypt: (plaintext: string) =>
|
|
19
|
+
export declare const desensEncrypt: (plaintext: string, encrypt: (plaintext: string) => DesensEncrypt[]) => {
|
|
20
20
|
ciphertext: string;
|
|
21
|
-
rules:
|
|
21
|
+
rules: DesensDecrypt[];
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* 脱敏解密(对密文进行多个片段解密)
|
|
25
|
-
* @param
|
|
25
|
+
* @param ciphertext 密文
|
|
26
26
|
* @param rules 解密要素
|
|
27
27
|
* @param decrypt 解密方法
|
|
28
28
|
*/
|
|
29
|
-
export declare const desensDecrypt: (ciphertext: string, rules:
|
|
29
|
+
export declare const desensDecrypt: (ciphertext: string, rules: DesensDecrypt | DesensDecrypt[], decrypt: (ciphertext: string) => string) => string;
|
|
30
30
|
type Replacer = string | {
|
|
31
31
|
[Symbol.replace](text: string, size: number): string;
|
|
32
32
|
};
|
|
@@ -36,5 +36,5 @@ type Replacer = string | {
|
|
|
36
36
|
* @param rules 解密要素
|
|
37
37
|
* @param replacer 替换者
|
|
38
38
|
*/
|
|
39
|
-
export declare const desensReplace: (ciphertext: string, rules:
|
|
39
|
+
export declare const desensReplace: (ciphertext: string, rules: DesensDecrypt | DesensDecrypt[], replacer?: Replacer) => string;
|
|
40
40
|
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { deepWeakEqual } from './compare/weak-equal';
|
|
|
5
5
|
export { hash8json } from './convert/json';
|
|
6
6
|
export { hash8object } from './convert/object';
|
|
7
7
|
export { hash8strings } from './convert/strings';
|
|
8
|
-
export { desensEncrypt, desensDecrypt, desensReplace } from './desens';
|
|
8
|
+
export { type DesensDecrypt, type DesensEncrypt, desensEncrypt, desensDecrypt, desensReplace } from './desens';
|
|
9
9
|
export { getEncoding } from './encoding';
|
|
10
10
|
export { inputRegex } from './input-regex';
|
|
11
11
|
export { isClass } from './is/class';
|
package/types/memory/basic.d.ts
CHANGED
|
@@ -31,6 +31,10 @@ export declare class MemoryBasic<T, Reactor, Type extends Memory.Type> {
|
|
|
31
31
|
constructor(key: Memory.Pitch<T, Type>, config: Config<Reactor>);
|
|
32
32
|
protected getType(data: T): Type;
|
|
33
33
|
push(...list: T[]): this;
|
|
34
|
+
/**
|
|
35
|
+
* 返回位于指定索引处的项
|
|
36
|
+
*/
|
|
37
|
+
at(index: number): T | undefined;
|
|
34
38
|
/**
|
|
35
39
|
* 遍历所有存储数据(按入栈顺序)
|
|
36
40
|
*/
|
|
@@ -52,7 +56,7 @@ export declare class MemoryBasic<T, Reactor, Type extends Memory.Type> {
|
|
|
52
56
|
*/
|
|
53
57
|
reduce<V>(callback: (previousValue: V, currentValue: T, currentIndex: number) => V, initialValue: V): V;
|
|
54
58
|
/**
|
|
55
|
-
*
|
|
59
|
+
* 判断存储是否包含指定类型
|
|
56
60
|
*/
|
|
57
61
|
includes(type: Type): boolean;
|
|
58
62
|
/**
|
package/types/memory/simple.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ type Transform<T, V> = {
|
|
|
6
6
|
};
|
|
7
7
|
type Basic<T, V, Type extends Memory.Type> = Assign<Transform<Omit<MemoryBasic<T, V, Type>, 'forType'>, MemorySimple<T, Type>>, {
|
|
8
8
|
get(type: Type): T | null;
|
|
9
|
+
at(index: number): T | undefined;
|
|
9
10
|
}>;
|
|
10
11
|
/**
|
|
11
12
|
* 简易存储(不分类)
|
|
@@ -14,6 +15,10 @@ export declare class MemorySimple<T, Type extends Memory.Type> implements Basic<
|
|
|
14
15
|
#private;
|
|
15
16
|
get size(): number;
|
|
16
17
|
constructor(key: Memory.Pitch<T, Type>);
|
|
18
|
+
/**
|
|
19
|
+
* 返回位于指定索引处的项
|
|
20
|
+
*/
|
|
21
|
+
at(index: number): T | undefined;
|
|
17
22
|
push(...list: T[]): this;
|
|
18
23
|
/**
|
|
19
24
|
* 获取指定类型存储数据
|
|
@@ -36,7 +41,7 @@ export declare class MemorySimple<T, Type extends Memory.Type> implements Basic<
|
|
|
36
41
|
*/
|
|
37
42
|
reduce<V>(callback: (previousValue: V, currentValue: T, currentIndex: number) => V, initialValue: V): V;
|
|
38
43
|
/**
|
|
39
|
-
*
|
|
44
|
+
* 判断是否包含指定类型
|
|
40
45
|
*/
|
|
41
46
|
includes(type: Type): boolean;
|
|
42
47
|
/**
|
package/types/neo4j-anchors.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ interface IBox {
|
|
|
4
4
|
centerY: number;
|
|
5
5
|
}
|
|
6
6
|
interface Config {
|
|
7
|
+
/** 多边之间的间隔弧长 */
|
|
7
8
|
radOffsetRaidx?: number;
|
|
8
9
|
getBox(id: string): IBox;
|
|
9
10
|
}
|
|
@@ -16,6 +17,10 @@ export default class Neo4jAhchors<INode extends object, IEdge extends object> {
|
|
|
16
17
|
protected config: Config;
|
|
17
18
|
constructor(neo4j: Neo4j<INode, IEdge>, config: Config);
|
|
18
19
|
protected getDir(start: string, end: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* 设置多边间隔弧长
|
|
22
|
+
*/
|
|
23
|
+
setRaidx(value: number): void;
|
|
19
24
|
/**
|
|
20
25
|
* 当图数据准备好后调用
|
|
21
26
|
*/
|