gff-nostream 1.3.9 → 2.0.1

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.
package/dist/api.d.ts CHANGED
@@ -1,4 +1,8 @@
1
- import { GFF3Feature } from './util';
1
+ import type { GFF3Feature } from './util.ts';
2
+ export interface LineRecord {
3
+ fields: string[];
4
+ lineHash?: string | number;
5
+ }
2
6
  /**
3
7
  * Synchronously parse a string containing GFF3 and return an array of the
4
8
  * parsed items.
@@ -8,4 +12,31 @@ import { GFF3Feature } from './util';
8
12
  * @returns array of parsed features, directives, comments and/or sequences
9
13
  */
10
14
  export declare function parseStringSync(str: string): GFF3Feature[];
11
- export { type GFF3FeatureLine, type GFF3Comment, type GFF3FeatureLineWithRefs, type GFF3Directive, type GFF3Sequence, type GFF3Feature, type GFF3Item, } from './util';
15
+ /**
16
+ * Synchronously parse an array of strings containing GFF3 and return an array of the
17
+ * parsed items.
18
+ *
19
+ * @param arr - GFF3 array of strings
20
+ * @param inputOptions - Parsing options
21
+ * @returns array of parsed features, directives, comments and/or sequences
22
+ */
23
+ export declare function parseArraySync(arr: string[]): GFF3Feature[];
24
+ /**
25
+ * Synchronously parse an array of LineRecord objects containing pre-split GFF3
26
+ * fields and return an array of the parsed items.
27
+ *
28
+ * @param records - Array of LineRecord objects with fields array and optional lineHash
29
+ * @returns array of parsed features
30
+ */
31
+ export declare function parseRecordsSync(records: LineRecord[]): GFF3Feature[];
32
+ /**
33
+ * Synchronously parse an array of LineRecord objects containing pre-split GFF3
34
+ * fields and return an array of the parsed items. Uses a fast path that skips
35
+ * unescaping when hasEscapes is false.
36
+ *
37
+ * @param records - Array of LineRecord objects with fields array and optional lineHash
38
+ * @param hasEscapes - Whether the records contain percent-encoded characters
39
+ * @returns array of parsed features
40
+ */
41
+ export declare function parseRecordsSyncFast(records: LineRecord[], hasEscapes: boolean): GFF3Feature[];
42
+ export type { GFF3Comment, GFF3Directive, GFF3Feature, GFF3FeatureLine, GFF3FeatureLineWithRefs, GFF3Item, GFF3Sequence, } from './util.ts';
package/dist/api.js CHANGED
@@ -4,7 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.parseStringSync = parseStringSync;
7
- const parse_1 = __importDefault(require("./parse"));
7
+ exports.parseArraySync = parseArraySync;
8
+ exports.parseRecordsSync = parseRecordsSync;
9
+ exports.parseRecordsSyncFast = parseRecordsSyncFast;
10
+ const parse_ts_1 = __importDefault(require("./parse.js"));
11
+ const util_ts_1 = require("./util.js");
8
12
  /**
9
13
  * Synchronously parse a string containing GFF3 and return an array of the
10
14
  * parsed items.
@@ -15,11 +19,11 @@ const parse_1 = __importDefault(require("./parse"));
15
19
  */
16
20
  function parseStringSync(str) {
17
21
  const items = [];
18
- const parser = new parse_1.default({
22
+ const parser = new parse_ts_1.default({
19
23
  featureCallback: arg => items.push(arg),
20
24
  disableDerivesFromReferences: true,
21
25
  errorCallback: err => {
22
- throw err;
26
+ throw new Error(err);
23
27
  },
24
28
  });
25
29
  for (const line of str.split(/\r?\n/)) {
@@ -28,4 +32,88 @@ function parseStringSync(str) {
28
32
  parser.finish();
29
33
  return items;
30
34
  }
35
+ /**
36
+ * Synchronously parse an array of strings containing GFF3 and return an array of the
37
+ * parsed items.
38
+ *
39
+ * @param arr - GFF3 array of strings
40
+ * @param inputOptions - Parsing options
41
+ * @returns array of parsed features, directives, comments and/or sequences
42
+ */
43
+ function parseArraySync(arr) {
44
+ const items = [];
45
+ const parser = new parse_ts_1.default({
46
+ featureCallback: arg => items.push(arg),
47
+ disableDerivesFromReferences: true,
48
+ errorCallback: err => {
49
+ throw new Error(err);
50
+ },
51
+ });
52
+ for (const line of arr) {
53
+ parser.addLine(line);
54
+ }
55
+ parser.finish();
56
+ return items;
57
+ }
58
+ /**
59
+ * Synchronously parse an array of LineRecord objects containing pre-split GFF3
60
+ * fields and return an array of the parsed items.
61
+ *
62
+ * @param records - Array of LineRecord objects with fields array and optional lineHash
63
+ * @returns array of parsed features
64
+ */
65
+ function parseRecordsSync(records) {
66
+ const items = [];
67
+ const parser = new parse_ts_1.default({
68
+ featureCallback: arg => items.push(arg),
69
+ disableDerivesFromReferences: true,
70
+ errorCallback: err => {
71
+ throw new Error(err);
72
+ },
73
+ });
74
+ for (const record of records) {
75
+ const featureLine = (0, util_ts_1.parseFieldsArray)(record.fields);
76
+ if (record.lineHash !== undefined) {
77
+ if (!featureLine.attributes) {
78
+ featureLine.attributes = {};
79
+ }
80
+ featureLine.attributes._lineHash = [String(record.lineHash)];
81
+ }
82
+ parser.addParsedFeatureLine(featureLine);
83
+ }
84
+ parser.finish();
85
+ return items;
86
+ }
87
+ /**
88
+ * Synchronously parse an array of LineRecord objects containing pre-split GFF3
89
+ * fields and return an array of the parsed items. Uses a fast path that skips
90
+ * unescaping when hasEscapes is false.
91
+ *
92
+ * @param records - Array of LineRecord objects with fields array and optional lineHash
93
+ * @param hasEscapes - Whether the records contain percent-encoded characters
94
+ * @returns array of parsed features
95
+ */
96
+ function parseRecordsSyncFast(records, hasEscapes) {
97
+ const items = [];
98
+ const parser = new parse_ts_1.default({
99
+ featureCallback: arg => items.push(arg),
100
+ disableDerivesFromReferences: true,
101
+ errorCallback: err => {
102
+ throw new Error(err);
103
+ },
104
+ });
105
+ const parseFunc = hasEscapes ? util_ts_1.parseFieldsArray : util_ts_1.parseFieldsArrayNoUnescape;
106
+ for (const record of records) {
107
+ const featureLine = parseFunc(record.fields);
108
+ if (record.lineHash !== undefined) {
109
+ if (!featureLine.attributes) {
110
+ featureLine.attributes = {};
111
+ }
112
+ featureLine.attributes._lineHash = [String(record.lineHash)];
113
+ }
114
+ parser.addParsedFeatureLine(featureLine);
115
+ }
116
+ parser.finish();
117
+ return items;
118
+ }
31
119
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],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 -1,3 +1,3 @@
1
- import { parseStringSync } from './api';
2
- export { parseStringSync };
3
- export type { GFF3Comment, GFF3Feature, GFF3Directive, GFF3FeatureLineWithRefs, GFF3FeatureLine, GFF3Item, GFF3Sequence, } from './api';
1
+ import { parseArraySync, parseRecordsSync, parseRecordsSyncFast, parseStringSync } from './api.ts';
2
+ export { parseArraySync, parseRecordsSync, parseRecordsSyncFast, parseStringSync };
3
+ export type { GFF3Comment, GFF3Directive, GFF3Feature, GFF3FeatureLine, GFF3FeatureLineWithRefs, GFF3Item, GFF3Sequence, LineRecord, } from './api.ts';
package/dist/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseStringSync = void 0;
4
- const api_1 = require("./api");
5
- Object.defineProperty(exports, "parseStringSync", { enumerable: true, get: function () { return api_1.parseStringSync; } });
3
+ exports.parseStringSync = exports.parseRecordsSyncFast = exports.parseRecordsSync = exports.parseArraySync = void 0;
4
+ const api_ts_1 = require("./api.js");
5
+ Object.defineProperty(exports, "parseArraySync", { enumerable: true, get: function () { return api_ts_1.parseArraySync; } });
6
+ Object.defineProperty(exports, "parseRecordsSync", { enumerable: true, get: function () { return api_ts_1.parseRecordsSync; } });
7
+ Object.defineProperty(exports, "parseRecordsSyncFast", { enumerable: true, get: function () { return api_ts_1.parseRecordsSyncFast; } });
8
+ Object.defineProperty(exports, "parseStringSync", { enumerable: true, get: function () { return api_ts_1.parseStringSync; } });
6
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+BAAuC;AAC9B,gGADA,qBAAe,OACA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAkG;AACzF,+FADA,uBAAc,OACA;AAAE,iGADA,yBAAgB,OACA;AAAE,qGADA,6BAAoB,OACA;AAAE,gGADA,wBAAe,OACA"}
package/dist/parse.d.ts CHANGED
@@ -1,23 +1,10 @@
1
- import * as GFF3 from './util';
2
- export declare class FASTAParser {
3
- seqCallback: (sequence: GFF3.GFF3Sequence) => void;
4
- currentSequence: {
5
- id: string;
6
- sequence: string;
7
- description?: string;
8
- } | undefined;
9
- constructor(seqCallback: (sequence: GFF3.GFF3Sequence) => void);
10
- addLine(line: string): void;
11
- private _flush;
12
- finish(): void;
13
- }
1
+ import * as GFF3 from './util.ts';
14
2
  interface ParserArgs {
15
3
  featureCallback?(feature: GFF3.GFF3Feature): void;
16
4
  endCallback?(): void;
17
5
  commentCallback?(comment: GFF3.GFF3Comment): void;
18
6
  errorCallback?(error: string): void;
19
7
  directiveCallback?(directive: GFF3.GFF3Directive): void;
20
- sequenceCallback?(sequence: GFF3.GFF3Sequence): void;
21
8
  bufferSize?: number;
22
9
  disableDerivesFromReferences?: boolean;
23
10
  }
@@ -28,9 +15,7 @@ export default class Parser {
28
15
  errorCallback: (error: string) => void;
29
16
  disableDerivesFromReferences: boolean;
30
17
  directiveCallback: (directive: GFF3.GFF3Directive) => void;
31
- sequenceCallback: (sequence: GFF3.GFF3Sequence) => void;
32
18
  bufferSize: number;
33
- fastaParser: FASTAParser | undefined;
34
19
  eof: boolean;
35
20
  lineNumber: number;
36
21
  private _underConstructionTopLevel;
@@ -39,6 +24,7 @@ export default class Parser {
39
24
  private _underConstructionOrphans;
40
25
  constructor(args: ParserArgs);
41
26
  addLine(line: string): void;
27
+ addParsedFeatureLine(featureLine: GFF3.GFF3FeatureLine): void;
42
28
  finish(): void;
43
29
  private _emitItem;
44
30
  private _enforceBufferSizeLimit;
@@ -48,6 +34,7 @@ export default class Parser {
48
34
  */
49
35
  private _emitAllUnderConstructionFeatures;
50
36
  private _bufferLine;
37
+ private _bufferParsedLine;
51
38
  private _resolveReferencesTo;
52
39
  private _parseError;
53
40
  private _resolveReferencesFrom;
package/dist/parse.js CHANGED
@@ -33,46 +33,14 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.FASTAParser = void 0;
37
- const GFF3 = __importStar(require("./util"));
38
- const containerAttributes = {
39
- Parent: 'child_features',
40
- Derives_from: 'derived_features',
41
- };
42
- class FASTAParser {
43
- constructor(seqCallback) {
44
- this.seqCallback = seqCallback;
45
- this.currentSequence = undefined;
46
- }
47
- addLine(line) {
48
- const defMatch = /^>\s*(\S+)\s*(.*)/.exec(line);
49
- if (defMatch) {
50
- this._flush();
51
- this.currentSequence = { id: defMatch[1], sequence: '' };
52
- if (defMatch[2]) {
53
- this.currentSequence.description = defMatch[2].trim();
54
- }
55
- }
56
- else if (this.currentSequence && /\S/.test(line)) {
57
- this.currentSequence.sequence += line.replaceAll(/\s/g, '');
58
- }
59
- }
60
- _flush() {
61
- if (this.currentSequence) {
62
- this.seqCallback(this.currentSequence);
63
- }
64
- }
65
- finish() {
66
- this._flush();
67
- }
68
- }
69
- exports.FASTAParser = FASTAParser;
36
+ const GFF3 = __importStar(require("./util.js"));
37
+ const featureLineRegex = /^\s*[^#\s>]/;
38
+ const commentOrDirectiveRegex = /^\s*(#+)(.*)/;
39
+ const blankLineRegex = /^\s*$/;
40
+ const fastaStartRegex = /^\s*>/;
41
+ const lineEndingRegex = /\r?\n?$/g;
70
42
  class Parser {
71
43
  constructor(args) {
72
- this.fastaParser = undefined;
73
- // if this is true, the parser ignores the
74
- // rest of the lines in the file. currently
75
- // set when the file switches over to FASTA
76
44
  this.eof = false;
77
45
  this.lineNumber = 0;
78
46
  // features that we have to keep on hand for now because they
@@ -96,29 +64,22 @@ class Parser {
96
64
  this.commentCallback = args.commentCallback || nullFunc;
97
65
  this.errorCallback = args.errorCallback || nullFunc;
98
66
  this.directiveCallback = args.directiveCallback || nullFunc;
99
- this.sequenceCallback = args.sequenceCallback || nullFunc;
100
67
  this.disableDerivesFromReferences =
101
68
  args.disableDerivesFromReferences || false;
102
69
  // number of lines to buffer
103
70
  this.bufferSize = args.bufferSize === undefined ? Infinity : args.bufferSize;
104
71
  }
105
72
  addLine(line) {
106
- // if we have transitioned to a fasta section, just delegate to that parser
107
- if (this.fastaParser) {
108
- this.fastaParser.addLine(line);
109
- return;
110
- }
111
73
  if (this.eof) {
112
- // otherwise, if we are done, ignore this line
113
74
  return;
114
75
  }
115
76
  this.lineNumber += 1;
116
- if (/^\s*[^#\s>]/.test(line)) {
77
+ if (featureLineRegex.test(line)) {
117
78
  // feature line, most common case
118
79
  this._bufferLine(line);
119
80
  return;
120
81
  }
121
- const match = /^\s*(#+)(.*)/.exec(line);
82
+ const match = commentOrDirectiveRegex.exec(line);
122
83
  if (match) {
123
84
  // directive or comment
124
85
  const [, hashsigns] = match;
@@ -133,7 +94,6 @@ class Parser {
133
94
  if (directive.directive === 'FASTA') {
134
95
  this._emitAllUnderConstructionFeatures();
135
96
  this.eof = true;
136
- this.fastaParser = new FASTAParser(this.sequenceCallback);
137
97
  }
138
98
  else {
139
99
  this._emitItem(directive);
@@ -141,31 +101,32 @@ class Parser {
141
101
  }
142
102
  }
143
103
  else {
144
- contents = contents.replace(/\s*/, '');
145
- this._emitItem({ comment: contents });
104
+ this._emitItem({ comment: contents.trimStart() });
146
105
  }
147
106
  }
148
- else if (/^\s*$/.test(line)) {
107
+ else if (blankLineRegex.test(line)) {
149
108
  // blank line, do nothing
150
109
  }
151
- else if (/^\s*>/.test(line)) {
152
- // implicit beginning of a FASTA section
110
+ else if (fastaStartRegex.test(line)) {
111
+ // implicit beginning of a FASTA section, stop parsing
153
112
  this._emitAllUnderConstructionFeatures();
154
113
  this.eof = true;
155
- this.fastaParser = new FASTAParser(this.sequenceCallback);
156
- this.fastaParser.addLine(line);
157
114
  }
158
115
  else {
159
116
  // it's a parse error
160
- const errLine = line.replaceAll(/\r?\n?$/g, '');
117
+ const errLine = line.replaceAll(lineEndingRegex, '');
161
118
  throw new Error(`GFF3 parse error. Cannot parse '${errLine}'.`);
162
119
  }
163
120
  }
121
+ addParsedFeatureLine(featureLine) {
122
+ if (this.eof) {
123
+ return;
124
+ }
125
+ this.lineNumber += 1;
126
+ this._bufferParsedLine(featureLine);
127
+ }
164
128
  finish() {
165
129
  this._emitAllUnderConstructionFeatures();
166
- if (this.fastaParser) {
167
- this.fastaParser.finish();
168
- }
169
130
  this.endCallback();
170
131
  }
171
132
  _emitItem(i) {
@@ -181,19 +142,24 @@ class Parser {
181
142
  }
182
143
  _enforceBufferSizeLimit(additionalItemCount = 0) {
183
144
  const _unbufferItem = (item) => {
184
- var _a, _b;
185
- if (item && Array.isArray(item) && ((_b = (_a = item[0].attributes) === null || _a === void 0 ? void 0 : _a.ID) === null || _b === void 0 ? void 0 : _b[0])) {
145
+ if (item && Array.isArray(item) && item[0].attributes?.ID?.[0]) {
186
146
  const ids = item[0].attributes.ID;
187
147
  ids.forEach(id => {
188
148
  delete this._underConstructionById[id];
189
149
  delete this._completedReferences[id];
190
150
  });
191
151
  item.forEach(i => {
152
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
192
153
  if (i.child_features) {
193
- i.child_features.forEach(c => _unbufferItem(c));
154
+ i.child_features.forEach(c => {
155
+ _unbufferItem(c);
156
+ });
194
157
  }
158
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
195
159
  if (i.derived_features) {
196
- i.derived_features.forEach(d => _unbufferItem(d));
160
+ i.derived_features.forEach(d => {
161
+ _unbufferItem(d);
162
+ });
197
163
  }
198
164
  });
199
165
  }
@@ -218,25 +184,24 @@ class Parser {
218
184
  this._completedReferences = {};
219
185
  // if we have any orphans hanging around still, this is a
220
186
  // problem. die with a parse error
221
- if (Array.from(Object.values(this._underConstructionOrphans)).length) {
222
- throw new Error(`some features reference other features that do not exist in the file (or in the same '###' scope). ${Object.keys(this._underConstructionOrphans).join(',')}`);
187
+ const orphanKeys = Object.keys(this._underConstructionOrphans);
188
+ if (orphanKeys.length) {
189
+ throw new Error(`some features reference other features that do not exist in the file (or in the same '###' scope). ${orphanKeys.join(',')}`);
223
190
  }
224
191
  }
225
- // do the right thing with a newly-parsed feature line
226
192
  _bufferLine(line) {
227
- var _a, _b, _c;
228
- const rawFeatureLine = GFF3.parseFeature(line);
229
- const featureLine = Object.assign(Object.assign({}, rawFeatureLine), { child_features: [], derived_features: [] });
230
- // featureLine._lineNumber = this.lineNumber //< debugging aid
231
- // NOTE: a feature is an arrayref of one or more feature lines.
232
- const ids = ((_a = featureLine.attributes) === null || _a === void 0 ? void 0 : _a.ID) || [];
233
- const parents = ((_b = featureLine.attributes) === null || _b === void 0 ? void 0 : _b.Parent) || [];
193
+ this._bufferParsedLine(GFF3.parseFeature(line));
194
+ }
195
+ _bufferParsedLine(rawFeatureLine) {
196
+ const featureLine = rawFeatureLine;
197
+ featureLine.child_features = [];
198
+ featureLine.derived_features = [];
199
+ const ids = featureLine.attributes?.ID || [];
200
+ const parents = featureLine.attributes?.Parent || [];
234
201
  const derives = this.disableDerivesFromReferences
235
202
  ? []
236
- : ((_c = featureLine.attributes) === null || _c === void 0 ? void 0 : _c.Derives_from) || [];
203
+ : featureLine.attributes?.Derives_from || [];
237
204
  if (!ids.length && !parents.length && !derives.length) {
238
- // if it has no IDs and does not refer to anything, we can just
239
- // output it
240
205
  this._emitItem([featureLine]);
241
206
  return;
242
207
  }
@@ -244,7 +209,6 @@ class Parser {
244
209
  ids.forEach(id => {
245
210
  const existing = this._underConstructionById[id];
246
211
  if (existing) {
247
- // another location of the same feature
248
212
  if (existing[existing.length - 1].type !== featureLine.type) {
249
213
  this._parseError(`multi-line feature "${id}" has inconsistent types: "${featureLine.type}", "${existing[existing.length - 1].type}"`);
250
214
  }
@@ -252,37 +216,28 @@ class Parser {
252
216
  feature = existing;
253
217
  }
254
218
  else {
255
- // haven't seen it yet, so buffer it so we can attach
256
- // child features to it
257
219
  feature = [featureLine];
258
220
  this._enforceBufferSizeLimit(1);
259
221
  if (!parents.length && !derives.length) {
260
222
  this._underConstructionTopLevel.push(feature);
261
223
  }
262
224
  this._underConstructionById[id] = feature;
263
- // see if we have anything buffered that refers to it
264
225
  this._resolveReferencesTo(feature, id);
265
226
  }
266
227
  });
267
- // try to resolve all its references
268
- this._resolveReferencesFrom(feature || [featureLine], { Parent: parents, Derives_from: derives }, ids);
228
+ this._resolveReferencesFrom(
229
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
230
+ feature || [featureLine], { Parent: parents, Derives_from: derives }, ids);
269
231
  }
270
232
  _resolveReferencesTo(feature, id) {
271
233
  const references = this._underConstructionOrphans[id];
272
- // references is of the form
273
- // {
274
- // 'Parent' : [ orphans that have a Parent attr referencing this feature ],
275
- // 'Derives_from' : [ orphans that have a Derives_from attr referencing this feature ],
276
- // }
277
234
  if (!references) {
278
235
  return;
279
236
  }
280
- feature.forEach(loc => {
237
+ for (const loc of feature) {
281
238
  loc.child_features.push(...references.Parent);
282
- });
283
- feature.forEach(loc => {
284
239
  loc.derived_features.push(...references.Derives_from);
285
- });
240
+ }
286
241
  delete this._underConstructionOrphans[id];
287
242
  }
288
243
  _parseError(message) {
@@ -290,61 +245,62 @@ class Parser {
290
245
  this.errorCallback(`${this.lineNumber}: ${message}`);
291
246
  }
292
247
  _resolveReferencesFrom(feature, references, ids) {
293
- // this is all a bit more awkward in javascript than it was in perl
294
- function postSet(obj, slot1, slot2) {
295
- let subObj = obj[slot1];
296
- if (!subObj) {
297
- subObj = {};
298
- obj[slot1] = subObj;
299
- }
300
- const returnVal = subObj[slot2] || false;
301
- subObj[slot2] = true;
302
- return returnVal;
303
- }
304
- references.Parent.forEach(toId => {
248
+ for (const toId of references.Parent) {
305
249
  const otherFeature = this._underConstructionById[toId];
306
250
  if (otherFeature) {
307
- const pname = containerAttributes.Parent;
308
- if (!ids.filter(id => postSet(this._completedReferences, id, `Parent,${toId}`)).length) {
309
- otherFeature.forEach(location => {
310
- location[pname].push(feature);
311
- });
251
+ let dominated = false;
252
+ for (const id of ids) {
253
+ const domKey = `Parent,${toId}`;
254
+ const rec = this._completedReferences[id] ||
255
+ (this._completedReferences[id] = {});
256
+ if (rec[domKey]) {
257
+ dominated = true;
258
+ }
259
+ rec[domKey] = true;
260
+ }
261
+ if (!dominated) {
262
+ for (const location of otherFeature) {
263
+ location.child_features.push(feature);
264
+ }
312
265
  }
313
266
  }
314
267
  else {
315
268
  let ref = this._underConstructionOrphans[toId];
316
269
  if (!ref) {
317
- ref = {
318
- Parent: [],
319
- Derives_from: [],
320
- };
270
+ ref = { Parent: [], Derives_from: [] };
321
271
  this._underConstructionOrphans[toId] = ref;
322
272
  }
323
273
  ref.Parent.push(feature);
324
274
  }
325
- });
326
- references.Derives_from.forEach(toId => {
275
+ }
276
+ for (const toId of references.Derives_from) {
327
277
  const otherFeature = this._underConstructionById[toId];
328
278
  if (otherFeature) {
329
- const pname = containerAttributes.Derives_from;
330
- if (!ids.filter(id => postSet(this._completedReferences, id, `Derives_from,${toId}`)).length) {
331
- otherFeature.forEach(location => {
332
- location[pname].push(feature);
333
- });
279
+ let dominated = false;
280
+ for (const id of ids) {
281
+ const domKey = `Derives_from,${toId}`;
282
+ const rec = this._completedReferences[id] ||
283
+ (this._completedReferences[id] = {});
284
+ if (rec[domKey]) {
285
+ dominated = true;
286
+ }
287
+ rec[domKey] = true;
288
+ }
289
+ if (!dominated) {
290
+ for (const location of otherFeature) {
291
+ location.derived_features.push(feature);
292
+ }
334
293
  }
335
294
  }
336
295
  else {
337
296
  let ref = this._underConstructionOrphans[toId];
338
297
  if (!ref) {
339
- ref = {
340
- Parent: [],
341
- Derives_from: [],
342
- };
298
+ ref = { Parent: [], Derives_from: [] };
343
299
  this._underConstructionOrphans[toId] = ref;
344
300
  }
345
301
  ref.Derives_from.push(feature);
346
302
  }
347
- });
303
+ }
348
304
  }
349
305
  }
350
306
  exports.default = Parser;
package/dist/parse.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;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