@fincity/kirun-js 1.1.6 → 1.3.0
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/__tests__/engine/runtime/expression/ExpressionEvaluationTest.ts +82 -1
- package/__tests__/engine/runtime/expression/ExpressionEvaluatorStringLiteralTest.ts +77 -0
- package/__tests__/engine/util/deepEqualTest.ts +13 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +24 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/engine/runtime/expression/Expression.ts +33 -0
- package/src/engine/runtime/expression/ExpressionEvaluator.ts +82 -8
- package/src/engine/runtime/expression/Operation.ts +5 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticMultiplicationOperator.ts +32 -0
- package/src/engine/runtime/expression/operators/binary/LogicalEqualOperator.ts +2 -7
- package/src/engine/runtime/expression/operators/binary/LogicalNotEqualOperator.ts +2 -7
- package/src/engine/runtime/expression/operators/binary/LogicalNullishCoalescingOperator.ts +8 -0
- package/src/engine/runtime/expression/operators/binary/index.ts +1 -0
- package/src/engine/util/Tuples.ts +49 -4
- package/src/engine/util/deepEqual.ts +49 -0
- package/src/index.ts +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export class Tuple2<F, S> {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
protected f: F;
|
|
3
|
+
protected s: S;
|
|
4
4
|
|
|
5
5
|
constructor(f: F, s: S) {
|
|
6
6
|
this.f = f;
|
|
@@ -14,10 +14,20 @@ export class Tuple2<F, S> {
|
|
|
14
14
|
public getT2(): S {
|
|
15
15
|
return this.s;
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
public setT1(f: F): Tuple2<F, S> {
|
|
19
|
+
this.f = f;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public setT2(s: S): Tuple2<F, S> {
|
|
24
|
+
this.s = s;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
export class Tuple3<F, S, T> extends Tuple2<F, S> {
|
|
20
|
-
|
|
30
|
+
protected t: T;
|
|
21
31
|
|
|
22
32
|
constructor(f: F, s: S, t: T) {
|
|
23
33
|
super(f, s);
|
|
@@ -27,10 +37,25 @@ export class Tuple3<F, S, T> extends Tuple2<F, S> {
|
|
|
27
37
|
public getT3(): T {
|
|
28
38
|
return this.t;
|
|
29
39
|
}
|
|
40
|
+
|
|
41
|
+
public setT1(f: F): Tuple3<F, S, T> {
|
|
42
|
+
this.f = f;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public setT2(s: S): Tuple3<F, S, T> {
|
|
47
|
+
this.s = s;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public setT3(t: T): Tuple3<F, S, T> {
|
|
52
|
+
this.t = t;
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
30
55
|
}
|
|
31
56
|
|
|
32
57
|
export class Tuple4<F, S, T, FR> extends Tuple3<F, S, T> {
|
|
33
|
-
|
|
58
|
+
protected fr: FR;
|
|
34
59
|
|
|
35
60
|
constructor(f: F, s: S, t: T, fr: FR) {
|
|
36
61
|
super(f, s, t);
|
|
@@ -40,4 +65,24 @@ export class Tuple4<F, S, T, FR> extends Tuple3<F, S, T> {
|
|
|
40
65
|
public getT4(): FR {
|
|
41
66
|
return this.fr;
|
|
42
67
|
}
|
|
68
|
+
|
|
69
|
+
public setT1(f: F): Tuple4<F, S, T, FR> {
|
|
70
|
+
this.f = f;
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public setT2(s: S): Tuple4<F, S, T, FR> {
|
|
75
|
+
this.s = s;
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public setT3(t: T): Tuple4<F, S, T, FR> {
|
|
80
|
+
this.t = t;
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public setT4(fr: FR): Tuple4<F, S, T, FR> {
|
|
85
|
+
this.fr = fr;
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
43
88
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { LinkedList } from './LinkedList';
|
|
2
|
+
|
|
3
|
+
export function deepEqual(x: any, y: any) {
|
|
4
|
+
let xa = new LinkedList();
|
|
5
|
+
xa.push(x);
|
|
6
|
+
let yb = new LinkedList();
|
|
7
|
+
yb.push(y);
|
|
8
|
+
|
|
9
|
+
while (!xa.isEmpty() && !yb.isEmpty()) {
|
|
10
|
+
const a: any = xa.pop();
|
|
11
|
+
const b: any = yb.pop();
|
|
12
|
+
|
|
13
|
+
if (a === b) continue;
|
|
14
|
+
|
|
15
|
+
const typeOfA = typeof a;
|
|
16
|
+
const typeOfB = typeof b;
|
|
17
|
+
|
|
18
|
+
if (typeOfA === 'undefined' || typeOfB === 'undefined') {
|
|
19
|
+
if (!a && !b) continue;
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (typeOfA !== typeOfB) return false;
|
|
24
|
+
|
|
25
|
+
if (Array.isArray(a)) {
|
|
26
|
+
if (!Array.isArray(b) || a.length != b.length) return false;
|
|
27
|
+
for (let i = 0; i < a.length; i++) {
|
|
28
|
+
xa.push(a[i]);
|
|
29
|
+
yb.push(b[i]);
|
|
30
|
+
}
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (typeOfA === 'object') {
|
|
35
|
+
const entriesOfA = Object.entries(a);
|
|
36
|
+
const entriesOfB = Object.entries(b);
|
|
37
|
+
if (entriesOfA.length !== entriesOfB.length) return false;
|
|
38
|
+
for (const [k, v] of entriesOfA) {
|
|
39
|
+
xa.push(v);
|
|
40
|
+
yb.push(b[k]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return true;
|
|
49
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './engine/util/string/StringFormatter';
|
|
|
10
10
|
export * from './engine/util/string/StringUtil';
|
|
11
11
|
export * from './engine/util/Tuples';
|
|
12
12
|
export * from './engine/util/ArrayUtil';
|
|
13
|
+
export * from './engine/util/deepEqual';
|
|
13
14
|
export * from './engine/runtime/StatementExecution';
|
|
14
15
|
export * from './engine/runtime/StatementMessage';
|
|
15
16
|
export * from './engine/runtime/ContextElement';
|