source: trip-planner-front/node_modules/@angular-devkit/core/src/virtual-fs/host/safe.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.5 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.SafeReadonlyHost = void 0;
11const rxjs_1 = require("rxjs");
12const operators_1 = require("rxjs/operators");
13/**
14 * A Host that filters out errors. The only exception is `read()` which will still error out if
15 * the delegate returned an error (e.g. NodeJS will error out if the file doesn't exist).
16 */
17class SafeReadonlyHost {
18 constructor(_delegate) {
19 this._delegate = _delegate;
20 }
21 get capabilities() {
22 return this._delegate.capabilities;
23 }
24 read(path) {
25 return this._delegate.read(path);
26 }
27 list(path) {
28 return this._delegate.list(path).pipe(operators_1.catchError(() => rxjs_1.of([])));
29 }
30 exists(path) {
31 return this._delegate.exists(path);
32 }
33 isDirectory(path) {
34 return this._delegate.isDirectory(path).pipe(operators_1.catchError(() => rxjs_1.of(false)));
35 }
36 isFile(path) {
37 return this._delegate.isFile(path).pipe(operators_1.catchError(() => rxjs_1.of(false)));
38 }
39 // Some hosts may not support stats.
40 stat(path) {
41 const maybeStat = this._delegate.stat(path);
42 return maybeStat && maybeStat.pipe(operators_1.catchError(() => rxjs_1.of(null)));
43 }
44}
45exports.SafeReadonlyHost = SafeReadonlyHost;
Note: See TracBrowser for help on using the repository browser.