settings.js 1.2 KB

1234567891011121314151617181920212223242526
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const path = require("path");
  4. const fsScandir = require("@nodelib/fs.scandir");
  5. class Settings {
  6. constructor(_options = {}) {
  7. this._options = _options;
  8. this.basePath = this._getValue(this._options.basePath, undefined);
  9. this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
  10. this.deepFilter = this._getValue(this._options.deepFilter, null);
  11. this.entryFilter = this._getValue(this._options.entryFilter, null);
  12. this.errorFilter = this._getValue(this._options.errorFilter, null);
  13. this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
  14. this.fsScandirSettings = new fsScandir.Settings({
  15. followSymbolicLinks: this._options.followSymbolicLinks,
  16. fs: this._options.fs,
  17. pathSegmentSeparator: this._options.pathSegmentSeparator,
  18. stats: this._options.stats,
  19. throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
  20. });
  21. }
  22. _getValue(option, value) {
  23. return option !== null && option !== void 0 ? option : value;
  24. }
  25. }
  26. exports.default = Settings;