@abaplint/runtime 2.7.33 → 2.7.35
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/types/numc.d.ts +3 -3
- package/build/src/types/numc.js +26 -2
- package/package.json +1 -1
|
@@ -14,8 +14,8 @@ export declare class Numc implements ICharacter {
|
|
|
14
14
|
getLength(): number;
|
|
15
15
|
clear(): void;
|
|
16
16
|
get(): string;
|
|
17
|
-
getOffset(
|
|
18
|
-
offset?: number;
|
|
19
|
-
length?: number;
|
|
17
|
+
getOffset(input: {
|
|
18
|
+
offset?: number | INumeric | Hex;
|
|
19
|
+
length?: number | INumeric | Hex;
|
|
20
20
|
}): Numc;
|
|
21
21
|
}
|
package/build/src/types/numc.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Numc = void 0;
|
|
4
|
+
const _parse_1 = require("../operators/_parse");
|
|
5
|
+
const throw_error_1 = require("../throw_error");
|
|
4
6
|
class Numc {
|
|
5
7
|
constructor(input) {
|
|
6
8
|
this.length = (input === null || input === void 0 ? void 0 : input.length) ? input === null || input === void 0 ? void 0 : input.length : 1;
|
|
@@ -41,8 +43,30 @@ class Numc {
|
|
|
41
43
|
get() {
|
|
42
44
|
return this.value;
|
|
43
45
|
}
|
|
44
|
-
getOffset(
|
|
45
|
-
|
|
46
|
+
getOffset(input) {
|
|
47
|
+
let offset = input === null || input === void 0 ? void 0 : input.offset;
|
|
48
|
+
if (offset) {
|
|
49
|
+
offset = (0, _parse_1.parse)(offset);
|
|
50
|
+
}
|
|
51
|
+
let length = input === null || input === void 0 ? void 0 : input.length;
|
|
52
|
+
if (length) {
|
|
53
|
+
length = (0, _parse_1.parse)(length);
|
|
54
|
+
}
|
|
55
|
+
if ((offset && offset >= this.length)
|
|
56
|
+
|| (offset && offset < 0)
|
|
57
|
+
|| (length && length < 0)) {
|
|
58
|
+
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
59
|
+
}
|
|
60
|
+
let ret = this.value;
|
|
61
|
+
if (offset) {
|
|
62
|
+
ret = ret.substr(offset);
|
|
63
|
+
}
|
|
64
|
+
if (length !== undefined) {
|
|
65
|
+
ret = ret.substr(0, length);
|
|
66
|
+
}
|
|
67
|
+
const r = new Numc({ length: ret.length });
|
|
68
|
+
r.set(ret);
|
|
69
|
+
return r;
|
|
46
70
|
}
|
|
47
71
|
}
|
|
48
72
|
exports.Numc = Numc;
|