@abaplint/runtime 2.10.62 → 2.10.64

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,3 +1,3 @@
1
1
  import { Table } from "../types";
2
2
  import { ICharacter } from "../types/_character";
3
- export declare function collect(source: ICharacter, target: Table): void;
3
+ export declare function collect(source: ICharacter | Table, target?: Table): void;
@@ -2,12 +2,25 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.collect = collect;
4
4
  const compare_1 = require("../compare");
5
+ const types_1 = require("../types");
5
6
  const insert_internal_1 = require("./insert_internal");
6
7
  const read_table_1 = require("./read_table");
7
8
  function collect(source, target) {
8
- const read = (0, read_table_1.readTable)(target, { withKey: (i) => { return (0, compare_1.eq)(i.table_line, source); } });
9
- if (read.subrc === 4) {
10
- (0, insert_internal_1.insertInternal)({ table: target, data: source });
9
+ if (target === undefined && source instanceof types_1.Table) {
10
+ // with header line
11
+ const read = (0, read_table_1.readTable)(source, { withKey: (i) => { return (0, compare_1.eq)(i.table_line, source.getHeader()); } });
12
+ if (read.subrc === 4) {
13
+ (0, insert_internal_1.insertInternal)({ table: source, data: source.getHeader() });
14
+ }
15
+ }
16
+ else if (target !== undefined) {
17
+ const read = (0, read_table_1.readTable)(target, { withKey: (i) => { return (0, compare_1.eq)(i.table_line, source); } });
18
+ if (read.subrc === 4) {
19
+ (0, insert_internal_1.insertInternal)({ table: target, data: source });
20
+ }
21
+ }
22
+ else {
23
+ throw "COLLECT, no target specified";
11
24
  }
12
25
  }
13
26
  //# sourceMappingURL=collect.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.10.62",
3
+ "version": "2.10.64",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",