@abaplint/runtime 2.11.27 → 2.11.29

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,12 +1,13 @@
1
1
  export * from "./add";
2
+ export * from "./bit-and";
3
+ export * from "./bit-not";
4
+ export * from "./bit-or";
5
+ export * from "./bit-xor";
6
+ export * from "./concat";
2
7
  export * from "./div";
3
8
  export * from "./divide";
4
9
  export * from "./minus";
5
10
  export * from "./mod";
6
11
  export * from "./multiply";
7
12
  export * from "./power";
8
- export * from "./bit-and";
9
- export * from "./bit-not";
10
- export * from "./bit-or";
11
- export * from "./bit-xor";
12
- export * from "./concat";
13
+ export * from "./table_expression";
@@ -15,15 +15,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./add"), exports);
18
+ __exportStar(require("./bit-and"), exports);
19
+ __exportStar(require("./bit-not"), exports);
20
+ __exportStar(require("./bit-or"), exports);
21
+ __exportStar(require("./bit-xor"), exports);
22
+ __exportStar(require("./concat"), exports);
18
23
  __exportStar(require("./div"), exports);
19
24
  __exportStar(require("./divide"), exports);
20
25
  __exportStar(require("./minus"), exports);
21
26
  __exportStar(require("./mod"), exports);
22
27
  __exportStar(require("./multiply"), exports);
23
28
  __exportStar(require("./power"), exports);
24
- __exportStar(require("./bit-and"), exports);
25
- __exportStar(require("./bit-not"), exports);
26
- __exportStar(require("./bit-or"), exports);
27
- __exportStar(require("./bit-xor"), exports);
28
- __exportStar(require("./concat"), exports);
29
+ __exportStar(require("./table_expression"), exports);
29
30
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ import { HashedTable, Integer, Table } from "../types";
2
+ import { ICharacter } from "../types/_character";
3
+ import { INumeric } from "../types/_numeric";
4
+ export interface ITableExpressionOptions {
5
+ index?: INumeric | ICharacter | string | Integer | number;
6
+ withKey?: (i: any) => boolean;
7
+ usesTableLine?: boolean;
8
+ }
9
+ export declare function tableExpression(source: Table | HashedTable, options: ITableExpressionOptions): any;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tableExpression = tableExpression;
4
+ const read_table_1 = require("../statements/read_table");
5
+ const throw_error_1 = require("../throw_error");
6
+ const _parse_1 = require("./_parse");
7
+ function tableExpression(source, options) {
8
+ let found;
9
+ if (options.index) {
10
+ found = source.array()[(0, _parse_1.parse)(options.index) - 1];
11
+ }
12
+ else if (options.withKey) {
13
+ found = (0, read_table_1.searchWithKey)(source.array(), options.withKey, 0, options?.usesTableLine).found;
14
+ }
15
+ else {
16
+ throw new Error("TableExpression runtime: todo");
17
+ }
18
+ if (found === undefined) {
19
+ (0, throw_error_1.throwError)("CX_SY_ITAB_LINE_NOT_FOUND");
20
+ }
21
+ return found;
22
+ }
23
+ //# sourceMappingURL=table_expression.js.map
@@ -7,6 +7,7 @@ const types_1 = require("../types");
7
7
  // todo, local classes?
8
8
  // check with javascript instanceof?
9
9
  // handling interfaces?
10
+ // todo: remove the "async"
10
11
  async function cast(target, source) {
11
12
  if (source instanceof types_1.ABAPObject && source.get() === undefined) {
12
13
  target.clear();
@@ -24,4 +24,9 @@ export type ReadTableReturn = {
24
24
  subrc: number;
25
25
  foundIndex: number;
26
26
  };
27
+ /** startIndex = javascript index, return ABAP index */
28
+ export declare function searchWithKey(arr: any, withKey: (i: any) => boolean, startIndex: number | undefined, usesTableLine: boolean | undefined): {
29
+ found: any;
30
+ foundIndex: number;
31
+ };
27
32
  export declare function readTable(table: Table | HashedTable | FieldSymbol, options?: IReadTableOptions): ReadTableReturn;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.searchWithKey = searchWithKey;
3
4
  exports.readTable = readTable;
4
5
  const binary_search_1 = require("../binary_search");
5
6
  const compare_1 = require("../compare");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.11.27",
3
+ "version": "2.11.29",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",