UNPKG

1.19 kBJavaScriptView Raw
1"use strict";
2var __values = (this && this.__values) || function(o) {
3 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4 if (m) return m.call(o);
5 if (o && typeof o.length === "number") return {
6 next: function () {
7 if (o && i >= o.length) o = void 0;
8 return { value: o && o[i++], done: !o };
9 }
10 };
11 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12};
13Object.defineProperty(exports, "__esModule", { value: true });
14function findNodeWithinGraph(nodeId, graph) {
15 var e_1, _a;
16 try {
17 for (var _b = __values(graph.nodes), _c = _b.next(); !_c.done; _c = _b.next()) {
18 var node = _c.value;
19 if (nodeId === node.id) {
20 return node;
21 }
22 }
23 }
24 catch (e_1_1) { e_1 = { error: e_1_1 }; }
25 finally {
26 try {
27 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
28 }
29 finally { if (e_1) throw e_1.error; }
30 }
31 throw Error('Could not find internal node within graph');
32}
33exports.findNodeWithinGraph = findNodeWithinGraph;
34//# sourceMappingURL=findNodeWithinGraph.js.map
\No newline at end of file