UNPKG

1.37 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 });
14exports.findPropertyInAstObject = void 0;
15// https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/utility/json-utils.ts
16function findPropertyInAstObject(node, propertyName) {
17 var e_1, _a;
18 var maybeNode = null;
19 try {
20 for (var _b = __values(node.properties), _c = _b.next(); !_c.done; _c = _b.next()) {
21 var property = _c.value;
22 if (property.key.value == propertyName) {
23 maybeNode = property.value;
24 }
25 }
26 }
27 catch (e_1_1) { e_1 = { error: e_1_1 }; }
28 finally {
29 try {
30 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
31 }
32 finally { if (e_1) throw e_1.error; }
33 }
34 return maybeNode;
35}
36exports.findPropertyInAstObject = findPropertyInAstObject;
37//# sourceMappingURL=json-utilts.js.map
\No newline at end of file