@abaplint/runtime 2.10.5 → 2.10.7

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.
@@ -1,7 +1,7 @@
1
1
  import { FieldSymbol, HashedTable, Table } from "../types";
2
2
  import { INumeric } from "../types/_numeric";
3
3
  export interface IDeleteInternalOptions {
4
- where?: (i: any) => boolean;
4
+ where?: (i: any) => Promise<boolean>;
5
5
  index?: INumeric;
6
6
  adjacent?: boolean;
7
7
  comparing?: string[];
@@ -79,7 +79,7 @@ async function deleteInternal(target, options) {
79
79
  index = abap.builtin.sy.get().tabix.get() - 1;
80
80
  if (options?.where) {
81
81
  const row = i instanceof types_1.Structure ? i.get() : { table_line: i };
82
- if (options.where(row) === true) {
82
+ if (await options.where(row) === true) {
83
83
  if (target instanceof types_1.HashedTable) {
84
84
  target.deleteFrom(i);
85
85
  }
@@ -6,6 +6,7 @@ export type replaceInput = {
6
6
  sectionLength?: INumeric;
7
7
  sectionOffset?: INumeric;
8
8
  replacementLength?: INumeric;
9
+ replacementCount?: INumeric;
9
10
  regex?: ICharacter;
10
11
  pcre?: ICharacter;
11
12
  all: boolean;
@@ -38,7 +38,8 @@ function replace(input) {
38
38
  found = temp.match(search) !== null;
39
39
  }
40
40
  else if (input.pcre) {
41
- const regex = abap_regex_1.ABAPRegExp.convert(input.pcre.get());
41
+ const str = input.pcre.get();
42
+ const regex = abap_regex_1.ABAPRegExp.convert(str);
42
43
  if (regex.length === 0 && input.all === true) {
43
44
  throw "REPLACE, zero length input";
44
45
  }
@@ -82,6 +83,10 @@ function replace(input) {
82
83
  }
83
84
  input.replacementLength.set(replacement.length);
84
85
  }
86
+ if (input.replacementCount) {
87
+ const match = temp.match(search);
88
+ input.replacementCount.set(match?.length || 0);
89
+ }
85
90
  temp = temp.replace(search, rr);
86
91
  const subrc = found ? 0 : 4;
87
92
  // @ts-ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.10.5",
3
+ "version": "2.10.7",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -29,12 +29,12 @@
29
29
  "author": "abaplint",
30
30
  "license": "MIT",
31
31
  "devDependencies": {
32
- "@types/chai": "^4.3.16",
32
+ "@types/chai": "^4.3.17",
33
33
  "@types/mocha": "^10.0.7",
34
- "chai": "^4.4.1",
35
- "mocha": "^10.6.0",
34
+ "chai": "^4.5.0",
35
+ "mocha": "^10.7.0",
36
36
  "source-map-support": "^0.5.21",
37
- "typescript": "^5.5.3"
37
+ "typescript": "^5.5.4"
38
38
  },
39
39
  "dependencies": {
40
40
  "temporal-polyfill": "^0.2.5"