@abaplint/runtime 1.6.39 → 1.6.43
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/build/src/operators/add.d.ts +2 -2
- package/build/src/operators/add.js +8 -1
- package/build/src/operators/divide.d.ts +2 -2
- package/build/src/operators/divide.js +1 -1
- package/build/src/operators/minus.d.ts +2 -2
- package/build/src/operators/minus.js +8 -1
- package/build/src/operators/multiply.d.ts +2 -2
- package/build/src/operators/multiply.js +8 -1
- package/build/src/operators/power.d.ts +2 -2
- package/build/src/operators/power.js +1 -1
- package/build/src/types/date.js +4 -0
- package/build/src/types/float.js +12 -4
- package/build/src/types/integer.js +4 -0
- package/build/src/types/time.js +4 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Integer } from "../types";
|
|
1
|
+
import { Float, Integer } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function add(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Integer;
|
|
4
|
+
export declare function add(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Float | Integer;
|
|
@@ -4,7 +4,14 @@ exports.add = void 0;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const _parse_1 = require("./_parse");
|
|
6
6
|
function add(left, right) {
|
|
7
|
-
|
|
7
|
+
if (left instanceof types_1.Integer && right instanceof types_1.Integer) {
|
|
8
|
+
return new types_1.Integer().set(left.get() + right.get());
|
|
9
|
+
}
|
|
10
|
+
else if (typeof left === "number" && typeof right === "number"
|
|
11
|
+
&& Number.isInteger(left) && Number.isInteger(right)) {
|
|
12
|
+
return new types_1.Integer().set(left + right);
|
|
13
|
+
}
|
|
14
|
+
return new types_1.Float().set((0, _parse_1.parse)(left) + (0, _parse_1.parse)(right));
|
|
8
15
|
}
|
|
9
16
|
exports.add = add;
|
|
10
17
|
//# sourceMappingURL=add.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Float } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function divide(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number):
|
|
4
|
+
export declare function divide(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Float;
|
|
@@ -6,7 +6,7 @@ const _parse_1 = require("./_parse");
|
|
|
6
6
|
// todo, this will only work when the target value is an integer?
|
|
7
7
|
function divide(left, right) {
|
|
8
8
|
const val = (0, _parse_1.parse)(left) / (0, _parse_1.parse)(right);
|
|
9
|
-
return new types_1.
|
|
9
|
+
return new types_1.Float().set(val);
|
|
10
10
|
}
|
|
11
11
|
exports.divide = divide;
|
|
12
12
|
//# sourceMappingURL=divide.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Integer } from "../types";
|
|
1
|
+
import { Float, Integer } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function minus(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Integer;
|
|
4
|
+
export declare function minus(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Float | Integer;
|
|
@@ -4,7 +4,14 @@ exports.minus = void 0;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const _parse_1 = require("./_parse");
|
|
6
6
|
function minus(left, right) {
|
|
7
|
-
|
|
7
|
+
if (left instanceof types_1.Integer && right instanceof types_1.Integer) {
|
|
8
|
+
return new types_1.Integer().set(left.get() - right.get());
|
|
9
|
+
}
|
|
10
|
+
else if (typeof left === "number" && typeof right === "number"
|
|
11
|
+
&& Number.isInteger(left) && Number.isInteger(right)) {
|
|
12
|
+
return new types_1.Integer().set(left - right);
|
|
13
|
+
}
|
|
14
|
+
return new types_1.Float().set((0, _parse_1.parse)(left) - (0, _parse_1.parse)(right));
|
|
8
15
|
}
|
|
9
16
|
exports.minus = minus;
|
|
10
17
|
//# sourceMappingURL=minus.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Integer } from "../types";
|
|
1
|
+
import { Float, Integer } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function multiply(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Integer;
|
|
4
|
+
export declare function multiply(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Float | Integer;
|
|
@@ -4,7 +4,14 @@ exports.multiply = void 0;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const _parse_1 = require("./_parse");
|
|
6
6
|
function multiply(left, right) {
|
|
7
|
-
|
|
7
|
+
if (left instanceof types_1.Integer && right instanceof types_1.Integer) {
|
|
8
|
+
return new types_1.Integer().set(left.get() * right.get());
|
|
9
|
+
}
|
|
10
|
+
else if (typeof left === "number" && typeof right === "number"
|
|
11
|
+
&& Number.isInteger(left) && Number.isInteger(right)) {
|
|
12
|
+
return new types_1.Integer().set(left * right);
|
|
13
|
+
}
|
|
14
|
+
return new types_1.Float().set((0, _parse_1.parse)(left) * (0, _parse_1.parse)(right));
|
|
8
15
|
}
|
|
9
16
|
exports.multiply = multiply;
|
|
10
17
|
//# sourceMappingURL=multiply.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Float } from "../types";
|
|
2
2
|
import { ICharacter } from "../types/_character";
|
|
3
3
|
import { INumeric } from "../types/_numeric";
|
|
4
|
-
export declare function power(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number):
|
|
4
|
+
export declare function power(left: INumeric | ICharacter | string | number, right: INumeric | ICharacter | string | number): Float;
|
|
@@ -4,7 +4,7 @@ exports.power = void 0;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const _parse_1 = require("./_parse");
|
|
6
6
|
function power(left, right) {
|
|
7
|
-
return new types_1.
|
|
7
|
+
return new types_1.Float().set(Math.pow((0, _parse_1.parse)(left), (0, _parse_1.parse)(right)));
|
|
8
8
|
}
|
|
9
9
|
exports.power = power;
|
|
10
10
|
//# sourceMappingURL=power.js.map
|
package/build/src/types/date.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Date = void 0;
|
|
4
4
|
const string_1 = require("./string");
|
|
5
5
|
const _javascript_date_1 = require("./_javascript_date");
|
|
6
|
+
const float_1 = require("./float");
|
|
6
7
|
class Date {
|
|
7
8
|
constructor() {
|
|
8
9
|
this.clear();
|
|
@@ -16,6 +17,9 @@ class Date {
|
|
|
16
17
|
this.value = (0, _javascript_date_1.getDateFromNumber)(value);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
20
|
+
else if (value instanceof float_1.Float) {
|
|
21
|
+
this.set(Math.round(value.getRaw()));
|
|
22
|
+
}
|
|
19
23
|
else if (typeof value === "string") {
|
|
20
24
|
this.value = value;
|
|
21
25
|
}
|
package/build/src/types/float.js
CHANGED
|
@@ -53,10 +53,18 @@ class Float {
|
|
|
53
53
|
get() {
|
|
54
54
|
let text = new Number(this.value).toExponential(16);
|
|
55
55
|
text = text.replace(".", ",");
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
if (text.includes("e+")) {
|
|
57
|
+
const split = text.split("e+");
|
|
58
|
+
const mantissa = split[0];
|
|
59
|
+
const exponent = split[1].padStart(2, "0");
|
|
60
|
+
return mantissa + "E+" + exponent;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const split = text.split("e-");
|
|
64
|
+
const mantissa = split[0];
|
|
65
|
+
const exponent = split[1].padStart(2, "0");
|
|
66
|
+
return mantissa + "E-" + exponent;
|
|
67
|
+
}
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
70
|
exports.Float = Float;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Integer = void 0;
|
|
4
|
+
const float_1 = require("./float");
|
|
4
5
|
const hex_1 = require("./hex");
|
|
5
6
|
const xstring_1 = require("./xstring");
|
|
6
7
|
class Integer {
|
|
@@ -17,6 +18,9 @@ class Integer {
|
|
|
17
18
|
else if (typeof value === "string") {
|
|
18
19
|
this.value = parseInt(value, 10);
|
|
19
20
|
}
|
|
21
|
+
else if (value instanceof float_1.Float) {
|
|
22
|
+
this.set(Math.round(value.getRaw()));
|
|
23
|
+
}
|
|
20
24
|
else if (value instanceof hex_1.Hex || value instanceof xstring_1.XString) {
|
|
21
25
|
this.set(parseInt(value.get(), 16));
|
|
22
26
|
}
|
package/build/src/types/time.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Time = void 0;
|
|
4
4
|
const string_1 = require("./string");
|
|
5
|
+
const _1 = require(".");
|
|
5
6
|
class Time {
|
|
6
7
|
constructor() {
|
|
7
8
|
this.clear();
|
|
@@ -17,6 +18,9 @@ class Time {
|
|
|
17
18
|
else if (typeof value === "string") {
|
|
18
19
|
this.value = value;
|
|
19
20
|
}
|
|
21
|
+
else if (value instanceof _1.Float) {
|
|
22
|
+
this.set(Math.round(value.getRaw()));
|
|
23
|
+
}
|
|
20
24
|
else {
|
|
21
25
|
this.set(value.get());
|
|
22
26
|
}
|