@abaplint/runtime 2.4.8 → 2.4.9

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.
@@ -5,6 +5,7 @@ const throw_error_1 = require("../throw_error");
5
5
  const float_1 = require("./float");
6
6
  const hex_1 = require("./hex");
7
7
  const xstring_1 = require("./xstring");
8
+ const digits = new RegExp(/^\s*-?\+?\d+\.?\d*$/i);
8
9
  class Integer {
9
10
  constructor(input) {
10
11
  this.value = 0;
@@ -17,11 +18,11 @@ class Integer {
17
18
  if (typeof value === "number") {
18
19
  this.value = Math.round(value);
19
20
  }
20
- else if (typeof value === "string" && value.trim().length === 0) {
21
- this.value = 0;
22
- }
23
21
  else if (typeof value === "string") {
24
- if (/^\s*-?\+?\d+\.?\d*$/i.test(value) === false) {
22
+ if (value.trim().length === 0) {
23
+ value = "0";
24
+ }
25
+ else if (digits.test(value) === false) {
25
26
  (0, throw_error_1.throwError)("CX_SY_CONVERSION_NO_NUMBER");
26
27
  }
27
28
  this.value = parseInt(value, 10);
@@ -114,7 +114,12 @@ class Table {
114
114
  insertIndex(item, index) {
115
115
  this.secondaryIndexes = {};
116
116
  const val = this.getValue(item);
117
- this.value.splice(index, 0, val);
117
+ if (index === 0) {
118
+ this.value.unshift(val);
119
+ }
120
+ else {
121
+ this.value.splice(index, 0, val);
122
+ }
118
123
  for (const l of this.loops.values()) {
119
124
  if (l.index <= index) {
120
125
  l.index++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.4.8",
3
+ "version": "2.4.9",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",