@abaplint/runtime 2.3.86 → 2.3.87

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,9 +1,12 @@
1
1
  import { Integer } from "../types";
2
2
  import { ICharacter } from "../types/_character";
3
+ import { INumeric } from "../types/_numeric";
3
4
  export declare type countInput = {
4
5
  val: ICharacter;
5
6
  sub: ICharacter;
6
7
  regex?: ICharacter;
7
8
  case?: ICharacter;
9
+ len?: INumeric;
10
+ off?: INumeric;
8
11
  };
9
12
  export declare function count(input: countInput): Integer;
@@ -5,7 +5,15 @@ const compare_1 = require("../compare");
5
5
  const types_1 = require("../types");
6
6
  function count(input) {
7
7
  let found = 0;
8
- const val = input.val.get();
8
+ let val = input.val.get();
9
+ if (input.off) {
10
+ const off = input.off.get();
11
+ val = val.substring(off);
12
+ }
13
+ if (input.len) {
14
+ const len = input.len.get();
15
+ val = val.substring(0, len);
16
+ }
9
17
  let reg = "";
10
18
  if (input.sub) {
11
19
  reg = input.sub.get();
@@ -18,6 +18,7 @@ export * from "./match";
18
18
  export * from "./matches";
19
19
  export * from "./nmax";
20
20
  export * from "./nmin";
21
+ export * from "./numofchar";
21
22
  export * from "./repeat";
22
23
  export * from "./replace";
23
24
  export * from "./reverse";
@@ -35,6 +35,7 @@ __exportStar(require("./match"), exports);
35
35
  __exportStar(require("./matches"), exports);
36
36
  __exportStar(require("./nmax"), exports);
37
37
  __exportStar(require("./nmin"), exports);
38
+ __exportStar(require("./numofchar"), exports);
38
39
  __exportStar(require("./repeat"), exports);
39
40
  __exportStar(require("./replace"), exports);
40
41
  __exportStar(require("./reverse"), exports);
@@ -0,0 +1,5 @@
1
+ import { Integer } from "../types";
2
+ import { ICharacter } from "../types/_character";
3
+ export declare function numofchar(input: {
4
+ val: ICharacter | string;
5
+ }): Integer;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.numofchar = void 0;
4
+ const types_1 = require("../types");
5
+ function numofchar(input) {
6
+ let str = "";
7
+ if (typeof input.val === "string") {
8
+ str = input.val;
9
+ }
10
+ else {
11
+ str = input.val.get();
12
+ }
13
+ return new types_1.Integer().set(str.length);
14
+ }
15
+ exports.numofchar = numofchar;
16
+ //# sourceMappingURL=numofchar.js.map
@@ -19,8 +19,19 @@ function ca(left, right) {
19
19
  else {
20
20
  r = right.get().toString();
21
21
  }
22
- const split = r.split("");
23
- return split.some(c => l.includes(c));
22
+ const characters = r.split("");
23
+ let fdpos = 0;
24
+ for (const c of l.split("")) {
25
+ if (characters.includes(c) === true) {
26
+ // @ts-ignore
27
+ abap.builtin.sy.get().fdpos.set(fdpos);
28
+ return true;
29
+ }
30
+ fdpos++;
31
+ }
32
+ // @ts-ignore
33
+ abap.builtin.sy.get().fdpos.set(fdpos);
34
+ return false;
24
35
  }
25
36
  exports.ca = ca;
26
37
  //# sourceMappingURL=ca.js.map
@@ -21,7 +21,18 @@ function co(left, right) {
21
21
  r = right.get().toString();
22
22
  }
23
23
  const characters = r.split("");
24
- return l.split("").every(c => characters.includes(c));
24
+ let fdpos = 0;
25
+ for (const c of l.split("")) {
26
+ if (characters.includes(c) === false) {
27
+ // @ts-ignore
28
+ abap.builtin.sy.get().fdpos.set(fdpos);
29
+ return false;
30
+ }
31
+ fdpos++;
32
+ }
33
+ // @ts-ignore
34
+ abap.builtin.sy.get().fdpos.set(fdpos);
35
+ return true;
25
36
  }
26
37
  exports.co = co;
27
38
  //# sourceMappingURL=co.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.3.86",
3
+ "version": "2.3.87",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",