[6a3a178] | 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/assertions", ["require", "exports"], factory);
|
---|
| 15 | }
|
---|
| 16 | })(function (require, exports) {
|
---|
| 17 | "use strict";
|
---|
| 18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 19 | exports.assertInterpolationSymbols = exports.assertArrayOfStrings = void 0;
|
---|
| 20 | function assertArrayOfStrings(identifier, value) {
|
---|
| 21 | if (value == null) {
|
---|
| 22 | return;
|
---|
| 23 | }
|
---|
| 24 | if (!Array.isArray(value)) {
|
---|
| 25 | throw new Error("Expected '" + identifier + "' to be an array of strings.");
|
---|
| 26 | }
|
---|
| 27 | for (var i = 0; i < value.length; i += 1) {
|
---|
| 28 | if (typeof value[i] !== 'string') {
|
---|
| 29 | throw new Error("Expected '" + identifier + "' to be an array of strings.");
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 | exports.assertArrayOfStrings = assertArrayOfStrings;
|
---|
| 34 | var UNUSABLE_INTERPOLATION_REGEXPS = [
|
---|
| 35 | /^\s*$/,
|
---|
| 36 | /[<>]/,
|
---|
| 37 | /^[{}]$/,
|
---|
| 38 | /&(#|[a-z])/i,
|
---|
| 39 | /^\/\//, // comment
|
---|
| 40 | ];
|
---|
| 41 | function assertInterpolationSymbols(identifier, value) {
|
---|
| 42 | if (value != null && !(Array.isArray(value) && value.length == 2)) {
|
---|
| 43 | throw new Error("Expected '" + identifier + "' to be an array, [start, end].");
|
---|
| 44 | }
|
---|
| 45 | else if (value != null) {
|
---|
| 46 | var start_1 = value[0];
|
---|
| 47 | var end_1 = value[1];
|
---|
| 48 | // Check for unusable interpolation symbols
|
---|
| 49 | UNUSABLE_INTERPOLATION_REGEXPS.forEach(function (regexp) {
|
---|
| 50 | if (regexp.test(start_1) || regexp.test(end_1)) {
|
---|
| 51 | throw new Error("['" + start_1 + "', '" + end_1 + "'] contains unusable interpolation symbol.");
|
---|
| 52 | }
|
---|
| 53 | });
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
| 56 | exports.assertInterpolationSymbols = assertInterpolationSymbols;
|
---|
| 57 | });
|
---|
| 58 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXJ0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9hc3NlcnRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7OztJQUVILFNBQWdCLG9CQUFvQixDQUFDLFVBQWtCLEVBQUUsS0FBVTtRQUNqRSxJQUFJLEtBQUssSUFBSSxJQUFJLEVBQUU7WUFDakIsT0FBTztTQUNSO1FBQ0QsSUFBSSxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLEVBQUU7WUFDekIsTUFBTSxJQUFJLEtBQUssQ0FBQyxlQUFhLFVBQVUsaUNBQThCLENBQUMsQ0FBQztTQUN4RTtRQUNELEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxLQUFLLENBQUMsTUFBTSxFQUFFLENBQUMsSUFBSSxDQUFDLEVBQUU7WUFDeEMsSUFBSSxPQUFPLEtBQUssQ0FBQyxDQUFDLENBQUMsS0FBSyxRQUFRLEVBQUU7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