source: trip-planner-front/node_modules/@schematics/angular/guard/index.js@ 6a3a178

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

initial commit

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[6a3a178]1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10const schematics_1 = require("@angular-devkit/schematics");
11const generate_from_files_1 = require("../utility/generate-from-files");
12const schema_1 = require("./schema");
13function default_1(options) {
14 if (!options.implements) {
15 throw new schematics_1.SchematicsException('Option "implements" is required.');
16 }
17 const implementations = options.implements
18 .map((implement) => (implement === 'CanDeactivate' ? 'CanDeactivate<unknown>' : implement))
19 .join(', ');
20 const commonRouterNameImports = ['ActivatedRouteSnapshot', 'RouterStateSnapshot'];
21 const routerNamedImports = [...options.implements, 'UrlTree'];
22 if (options.implements.includes(schema_1.Implement.CanLoad)) {
23 routerNamedImports.push('Route', 'UrlSegment');
24 if (options.implements.length > 1) {
25 routerNamedImports.push(...commonRouterNameImports);
26 }
27 }
28 else {
29 routerNamedImports.push(...commonRouterNameImports);
30 }
31 routerNamedImports.sort();
32 const implementationImports = routerNamedImports.join(', ');
33 return generate_from_files_1.generateFromFiles(options, {
34 implementations,
35 implementationImports,
36 });
37}
38exports.default = default_1;
Note: See TracBrowser for help on using the repository browser.