source: trip-planner-front/node_modules/@angular-devkit/schematics/src/rules/move.js@ 6a80231

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

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
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 });
10exports.move = void 0;
11const core_1 = require("@angular-devkit/core");
12const base_1 = require("./base");
13function move(from, to) {
14 if (to === undefined) {
15 to = from;
16 from = '/';
17 }
18 const fromPath = core_1.normalize('/' + from);
19 const toPath = core_1.normalize('/' + to);
20 if (fromPath === toPath) {
21 return base_1.noop;
22 }
23 return (tree) => {
24 if (tree.exists(fromPath)) {
25 // fromPath is a file
26 tree.rename(fromPath, toPath);
27 }
28 else {
29 // fromPath is a directory
30 tree.getDir(fromPath).visit((path) => {
31 tree.rename(path, core_1.join(toPath, path.substr(fromPath.length)));
32 });
33 }
34 return tree;
35 };
36}
37exports.move = move;
Note: See TracBrowser for help on using the repository browser.