@abaplint/runtime 2.0.14 → 2.0.15
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/builtin/index.d.ts +2 -1
- package/build/src/builtin/index.js +2 -1
- package/build/src/builtin/to_mixed.d.ts +9 -0
- package/build/src/builtin/to_mixed.js +48 -0
- package/build/src/compare/eq.js +5 -1
- package/build/src/statements/message.js +7 -0
- package/build/src/template_formatting.d.ts +1 -0
- package/build/src/template_formatting.js +3 -0
- package/package.json +2 -2
|
@@ -11,9 +11,9 @@ export * from "./find";
|
|
|
11
11
|
export * from "./floor";
|
|
12
12
|
export * from "./frac";
|
|
13
13
|
export * from "./insert";
|
|
14
|
+
export * from "./lines";
|
|
14
15
|
export * from "./match";
|
|
15
16
|
export * from "./matches";
|
|
16
|
-
export * from "./lines";
|
|
17
17
|
export * from "./nmax";
|
|
18
18
|
export * from "./nmin";
|
|
19
19
|
export * from "./repeat";
|
|
@@ -31,6 +31,7 @@ export * from "./substring";
|
|
|
31
31
|
export * from "./sy";
|
|
32
32
|
export * from "./tan";
|
|
33
33
|
export * from "./to_lower";
|
|
34
|
+
export * from "./to_mixed";
|
|
34
35
|
export * from "./to_upper";
|
|
35
36
|
export * from "./trunc";
|
|
36
37
|
export * from "./xstrlen";
|
|
@@ -28,9 +28,9 @@ __exportStar(require("./find"), exports);
|
|
|
28
28
|
__exportStar(require("./floor"), exports);
|
|
29
29
|
__exportStar(require("./frac"), exports);
|
|
30
30
|
__exportStar(require("./insert"), exports);
|
|
31
|
+
__exportStar(require("./lines"), exports);
|
|
31
32
|
__exportStar(require("./match"), exports);
|
|
32
33
|
__exportStar(require("./matches"), exports);
|
|
33
|
-
__exportStar(require("./lines"), exports);
|
|
34
34
|
__exportStar(require("./nmax"), exports);
|
|
35
35
|
__exportStar(require("./nmin"), exports);
|
|
36
36
|
__exportStar(require("./repeat"), exports);
|
|
@@ -48,6 +48,7 @@ __exportStar(require("./substring"), exports);
|
|
|
48
48
|
__exportStar(require("./sy"), exports);
|
|
49
49
|
__exportStar(require("./tan"), exports);
|
|
50
50
|
__exportStar(require("./to_lower"), exports);
|
|
51
|
+
__exportStar(require("./to_mixed"), exports);
|
|
51
52
|
__exportStar(require("./to_upper"), exports);
|
|
52
53
|
__exportStar(require("./trunc"), exports);
|
|
53
54
|
__exportStar(require("./xstrlen"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { String } from "../types";
|
|
2
|
+
import { ICharacter } from "../types/_character";
|
|
3
|
+
import { INumeric } from "../types/_numeric";
|
|
4
|
+
export declare function to_mixed(input: {
|
|
5
|
+
val: ICharacter | string;
|
|
6
|
+
sep?: ICharacter | string;
|
|
7
|
+
case?: ICharacter | string;
|
|
8
|
+
min?: INumeric | number;
|
|
9
|
+
}): String;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.to_mixed = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
function to_mixed(input) {
|
|
7
|
+
let sep = input.sep;
|
|
8
|
+
if (sep === undefined) {
|
|
9
|
+
sep = "_";
|
|
10
|
+
}
|
|
11
|
+
if (typeof sep !== "string") {
|
|
12
|
+
sep = sep.get();
|
|
13
|
+
}
|
|
14
|
+
if (sep.length === 0) {
|
|
15
|
+
throw "CX_SY_STRG_PAR_VAL";
|
|
16
|
+
}
|
|
17
|
+
const min = 1;
|
|
18
|
+
if (min < 0) {
|
|
19
|
+
throw "CX_SY_STRG_PAR_VAL";
|
|
20
|
+
}
|
|
21
|
+
let val = input.val;
|
|
22
|
+
if (typeof val !== "string") {
|
|
23
|
+
val = val.get();
|
|
24
|
+
}
|
|
25
|
+
val = val.substring(0, min) + val.substring(min).toLowerCase();
|
|
26
|
+
if (input.case) {
|
|
27
|
+
if (typeof input.case === "string") {
|
|
28
|
+
if (input.case === input.case.toLowerCase()) {
|
|
29
|
+
val = val.substring(0, 1).toLowerCase() + val.substring(1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
if (input.case.get() === input.case.get().toLowerCase()) {
|
|
34
|
+
val = val.substring(0, 1).toLowerCase() + val.substring(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const length = sep.length;
|
|
39
|
+
const regex = new RegExp(sep + "\\w");
|
|
40
|
+
while (val.match(regex)) {
|
|
41
|
+
val = val.replace(regex, (x) => {
|
|
42
|
+
return x.substring(length).toUpperCase();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return new types_1.String().set(val);
|
|
46
|
+
}
|
|
47
|
+
exports.to_mixed = to_mixed;
|
|
48
|
+
//# sourceMappingURL=to_mixed.js.map
|
package/build/src/compare/eq.js
CHANGED
|
@@ -80,7 +80,11 @@ function eq(left, right) {
|
|
|
80
80
|
else if (left instanceof types_1.Hex && typeof r === "number") {
|
|
81
81
|
l = parseInt(left.get(), 16);
|
|
82
82
|
}
|
|
83
|
-
if (right instanceof types_1.Float &&
|
|
83
|
+
if (right instanceof types_1.Float && left instanceof types_1.Float) {
|
|
84
|
+
r = right.getRaw();
|
|
85
|
+
l = left.getRaw();
|
|
86
|
+
}
|
|
87
|
+
else if (right instanceof types_1.Float && typeof l === "number") {
|
|
84
88
|
r = right.getRaw();
|
|
85
89
|
}
|
|
86
90
|
else if (left instanceof types_1.Float) {
|
|
@@ -54,6 +54,11 @@ class MessageStatement {
|
|
|
54
54
|
arbgb = arbgb.get();
|
|
55
55
|
}
|
|
56
56
|
arbgb = arbgb === null || arbgb === void 0 ? void 0 : arbgb.toUpperCase();
|
|
57
|
+
let msgty = options.type;
|
|
58
|
+
if (msgty !== undefined && typeof msgty !== "string") {
|
|
59
|
+
msgty = msgty.get();
|
|
60
|
+
}
|
|
61
|
+
msgty = msgty === null || msgty === void 0 ? void 0 : msgty.toUpperCase();
|
|
57
62
|
// @ts-ignore
|
|
58
63
|
abap.builtin.sy.get().msgid.set(arbgb);
|
|
59
64
|
let msgnr = options.number;
|
|
@@ -62,6 +67,8 @@ class MessageStatement {
|
|
|
62
67
|
}
|
|
63
68
|
// @ts-ignore
|
|
64
69
|
abap.builtin.sy.get().msgno.set(msgnr);
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
abap.builtin.sy.get().msgty.set(msgty);
|
|
65
72
|
const text = await findText(this.context, arbgb, msgnr);
|
|
66
73
|
const replaced = replace(text, options.with);
|
|
67
74
|
if (options.into) {
|
|
@@ -4,6 +4,9 @@ exports.templateFormatting = void 0;
|
|
|
4
4
|
const types_1 = require("./types");
|
|
5
5
|
function templateFormatting(source, options) {
|
|
6
6
|
let text = source.get() + "";
|
|
7
|
+
if (options.currency !== undefined) {
|
|
8
|
+
throw "template formatting with currency not supported";
|
|
9
|
+
}
|
|
7
10
|
if (options.timestamp === "iso") {
|
|
8
11
|
text = text.substr(0, 4) + "-" + text.substr(4, 2) + "-" + text.substr(6, 2) + "T" + text.substr(8, 2) + ":" + text.substr(10, 2) + ":" + text.substr(12, 2);
|
|
9
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/runtime",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"description": "Transpiler - Runtime",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
"chai": "^4.3.6",
|
|
35
35
|
"mocha": "^9.2.2",
|
|
36
36
|
"source-map-support": "^0.5.21",
|
|
37
|
-
"typescript": "^4.6.
|
|
37
|
+
"typescript": "^4.6.4"
|
|
38
38
|
}
|
|
39
39
|
}
|