source: trip-planner-front/node_modules/@angular/compiler/src/pipe_resolver.js@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 5.4 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8(function (factory) {
9 if (typeof module === "object" && typeof module.exports === "object") {
10 var v = factory(require, exports);
11 if (v !== undefined) module.exports = v;
12 }
13 else if (typeof define === "function" && define.amd) {
14 define("@angular/compiler/src/pipe_resolver", ["require", "exports", "@angular/compiler/src/core", "@angular/compiler/src/directive_resolver", "@angular/compiler/src/util"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.PipeResolver = void 0;
20 var core_1 = require("@angular/compiler/src/core");
21 var directive_resolver_1 = require("@angular/compiler/src/directive_resolver");
22 var util_1 = require("@angular/compiler/src/util");
23 /**
24 * Resolve a `Type` for {@link Pipe}.
25 *
26 * This interface can be overridden by the application developer to create custom behavior.
27 *
28 * See {@link Compiler}
29 */
30 var PipeResolver = /** @class */ (function () {
31 function PipeResolver(_reflector) {
32 this._reflector = _reflector;
33 }
34 PipeResolver.prototype.isPipe = function (type) {
35 var typeMetadata = this._reflector.annotations(util_1.resolveForwardRef(type));
36 return typeMetadata && typeMetadata.some(core_1.createPipe.isTypeOf);
37 };
38 /**
39 * Return {@link Pipe} for a given `Type`.
40 */
41 PipeResolver.prototype.resolve = function (type, throwIfNotFound) {
42 if (throwIfNotFound === void 0) { throwIfNotFound = true; }
43 var metas = this._reflector.annotations(util_1.resolveForwardRef(type));
44 if (metas) {
45 var annotation = directive_resolver_1.findLast(metas, core_1.createPipe.isTypeOf);
46 if (annotation) {
47 return annotation;
48 }
49 }
50 if (throwIfNotFound) {
51 throw new Error("No Pipe decorator found on " + util_1.stringify(type));
52 }
53 return null;
54 };
55 return Pipe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lsZXJ9XG4gKi9cbmV4cG9ydCBjbGFzcyBQaXBlUmVzb2x2ZXIge1xuICBjb25zdHJ1Y3Rvcihwcml2YXRlIF9yZWZsZWN0b3I6IENvbXBpbGVSZWZsZWN0b3IpIHt9XG5cbiAgaXNQaXBlKHR5cGU6IFR5cGUpIHtcbiAgICBjb25zdCB0eXBlTWV0YWRhdGEgPSB0aGlzLl9yZWZsZWN0b3IuYW5ub3RhdGlvbnMocmVzb2x2ZUZvcndhcmRSZWYodHlwZSkpO1xuICAgIHJldHVybiB0eXBlTWV0YWRhdGEgJiYgdHlwZU1ldGFkYXRhLnNvbWUoY3JlYXRlUGlwZS5pc1R5cGVPZik7XG4gIH1cblxuICAvKipcbiAgICogUmV0dXJuIHtAbGluayBQaXBlfSBmb3IgYSBnaXZlbiBgVHlwZWAuXG4gICAqL1xuICByZXNvbHZlKHR5cGU6IFR5cGUsIHRocm93SWZOb3RGb3VuZCA9IHRydWUpOiBQaXBlfG51bGwge1xuICAgIGNvbnN0IG1ldGFzID0gdGhpcy5fcmVmbGVjdG9yLmFubm90YXRpb25zKHJlc29sdmVGb3J3YXJkUmVmKHR5cGUpKTtcbiAgICBpZiAobWV0YXMpIHtcbiAgICAgIGNvbnN0IGFubm90YXRpb24gPSBmaW5kTGFzdChtZXRhcywgY3JlYXRlUGlwZS5pc1R5cGVPZik7XG4gICAgICBpZiAoYW5ub3RhdGlvbikge1xuICAgICAgICByZXR1cm4gYW5ub3RhdGlvbjtcbiAgICAgIH1cbiAgICB9XG4gICAgaWYgKHRocm93SWZOb3RGb3VuZCkge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKGBObyBQaXBlIGRlY29yYXRvciBmb3VuZCBvbiAke3N0cmluZ2lmeSh0eXBlKX1gKTtcbiAgICB9XG4gICAgcmV0dXJuIG51bGw7XG4gIH1cbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.