UNPKG

1.08 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const path = require("path");
4const fsStat = require("@nodelib/fs.stat");
5const fs = require("./adapters/fs");
6class Settings {
7 constructor(_options = {}) {
8 this._options = _options;
9 this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
10 this.fs = fs.createFileSystemAdapter(this._options.fs);
11 this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
12 this.stats = this._getValue(this._options.stats, false);
13 this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
14 this.fsStatSettings = new fsStat.Settings({
15 followSymbolicLink: this.followSymbolicLinks,
16 fs: this.fs,
17 throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
18 });
19 }
20 _getValue(option, value) {
21 return option !== null && option !== void 0 ? option : value;
22 }
23}
24exports.default = Settings;