source: trip-planner-front/node_modules/@angular/compiler/esm2015/src/assertions.js@ e29cc2e

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

initial commit

  • Property mode set to 100644
File size: 4.9 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 */
8export function assertArrayOfStrings(identifier, value) {
9 if (value == null) {
10 return;
11 }
12 if (!Array.isArray(value)) {
13 throw new Error(`Expected '${identifier}' to be an array of strings.`);
14 }
15 for (let i = 0; i < value.length; i += 1) {
16 if (typeof value[i] !== 'string') {
17 throw new Error(`Expected '${identifier}' to be an array of strings.`);
18 }
19 }
20}
21const UNUSABLE_INTERPOLATION_REGEXPS = [
22 /^\s*$/,
23 /[<>]/,
24 /^[{}]$/,
25 /&(#|[a-z])/i,
26 /^\/\//, // comment
27];
28export function assertInterpolationSymbols(identifier, value) {
29 if (value != null && !(Array.isArray(value) && value.length == 2)) {
30 throw new Error(`Expected '${identifier}' to be an array, [start, end].`);
31 }
32 else if (value != null) {
33 const start = value[0];
34 const end = value[1];
35 // Check for unusable interpolation symbols
36 UNUSABLE_INTERPOLATION_REGEXPS.forEach(regexp => {
37 if (regexp.test(start) || regexp.test(end)) {
38 throw new Error(`['${start}', '${end}'] contains unusable interpolation symbol.`);
39 }
40 });
41 }
42}
43//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXJ0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9hc3NlcnRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE1BQU0sVUFBVSxvQkFBb0IsQ0FBQyxVQUFrQixFQUFFLEtBQVU7SUFDakUsSUFBSS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gbmV3IEVycm9yKGBbJyR7c3RhcnR9JywgJyR7ZW5kfSddIGNvbnRhaW5zIHVudXNhYmxlIGludGVycG9sYXRpb24gc3ltYm9sLmApO1xuICAgICAgfVxuICAgIH0pO1xuICB9XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.