| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
const path = require("path"); |
| 4 |
const fsStat = require("@nodelib/fs.stat"); |
| 5 |
const fs = require("./adapters/fs"); |
| 6 |
class 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 |
} |
| 24 |
exports.default = Settings; |