@abaplint/runtime 2.8.16 → 2.8.18

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.
@@ -50,7 +50,7 @@ function concatenate(input) {
50
50
  }
51
51
  result += val + sep;
52
52
  }
53
- if (result.length > 0) {
53
+ if (sep.length > 0 && result.length > 0) {
54
54
  result = result.slice(0, result.length - sep.length);
55
55
  }
56
56
  input.target.set(result);
@@ -1,12 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HexUInt8 = void 0;
4
+ /* eslint-disable no-bitwise */
4
5
  const _parse_1 = require("../operators/_parse");
5
6
  const float_1 = require("./float");
6
7
  const xstring_1 = require("./xstring");
7
8
  const throw_error_1 = require("../throw_error");
8
9
  const integer8_1 = require("./integer8");
9
10
  const REGEXP = /^(?![A-F0-9])/;
11
+ const LUT_HEX_4b = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"];
12
+ const LUT_HEX_8b = new Array(0x100);
13
+ for (let n = 0; n < 0x100; n++) {
14
+ LUT_HEX_8b[n] = `${LUT_HEX_4b[(n >>> 4) & 0xF]}${LUT_HEX_4b[n & 0xF]}`;
15
+ }
10
16
  class HexUInt8 {
11
17
  constructor(input) {
12
18
  this.length = input?.length ? input?.length : 1;
@@ -105,7 +111,13 @@ class HexUInt8 {
105
111
  }
106
112
  }
107
113
  get() {
108
- return Buffer.from(this.value).toString("hex").toUpperCase();
114
+ // return Buffer.from(this.value).toString("hex").toUpperCase();
115
+ let out = "";
116
+ // eslint-disable-next-line @typescript-eslint/prefer-for-of
117
+ for (let idx = 0; idx < this.value.length; idx++) {
118
+ out += LUT_HEX_8b[this.value[idx]];
119
+ }
120
+ return out;
109
121
  }
110
122
  getOffset(input) {
111
123
  let offset = input?.offset;
@@ -149,8 +161,13 @@ class HexUInt8 {
149
161
  console.dir(this.value.subarray(offset, length ? offset + length : undefined));
150
162
  console.dir(Buffer.from(this.value.subarray(offset, length ? offset + length : undefined)));
151
163
  */
152
- const str = Buffer.from(this.value.subarray(offset, length ? offset + length : undefined)).toString("hex")
153
- .toUpperCase();
164
+ // const str = Buffer.from(this.value.subarray(offset, length ? offset + length : undefined)).toString("hex").toUpperCase();
165
+ let str = "";
166
+ const until = length ? offset + length : this.value.length;
167
+ // eslint-disable-next-line @typescript-eslint/prefer-for-of
168
+ for (let idx = offset; idx < until; idx++) {
169
+ str += LUT_HEX_8b[this.value[idx]];
170
+ }
154
171
  return new xstring_1.XString().set(str);
155
172
  }
156
173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.8.16",
3
+ "version": "2.8.18",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "author": "abaplint",
30
30
  "license": "MIT",
31
31
  "devDependencies": {
32
- "@types/chai": "^4.3.12",
32
+ "@types/chai": "^4.3.13",
33
33
  "@types/mocha": "^10.0.6",
34
34
  "chai": "^4.4.1",
35
35
  "mocha": "^10.3.0",