Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
  4. const fs = require("fs");
  5. const os = require("os");
  6. const CPU_COUNT = os.cpus().length;
  7. exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
  8. lstat: fs.lstat,
  9. lstatSync: fs.lstatSync,
  10. stat: fs.stat,
  11. statSync: fs.statSync,
  12. readdir: fs.readdir,
  13. readdirSync: fs.readdirSync
  14. };
  15. class Settings {
  16. constructor(_options = {}) {
  17. this._options = _options;
  18. this.absolute = this._getValue(this._options.absolute, false);
  19. this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
  20. this.braceExpansion = this._getValue(this._options.braceExpansion, true);
  21. this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
  22. this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
  23. this.cwd = this._getValue(this._options.cwd, process.cwd());
  24. this.deep = this._getValue(this._options.deep, Infinity);
  25. this.dot = this._getValue(this._options.dot, false);
  26. this.extglob = this._getValue(this._options.extglob, true);
  27. this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
  28. this.fs = this._getFileSystemMethods(this._options.fs);
  29. this.globstar = this._getValue(this._options.globstar, true);
  30. this.ignore = this._getValue(this._options.ignore, []);
  31. this.markDirectories = this._getValue(this._options.markDirectories, false);
  32. this.objectMode = this._getValue(this._options.objectMode, false);
  33. this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
  34. this.onlyFiles = this._getValue(this._options.onlyFiles, true);
  35. this.stats = this._getValue(this._options.stats, false);
  36. this.suppressErrors = this._getValue(this._options.suppressErrors, false);
  37. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
  38. this.unique = this._getValue(this._options.unique, true);
  39. if (this.onlyDirectories) {
  40. this.onlyFiles = false;
  41. }
  42. if (this.stats) {
  43. this.objectMode = true;
  44. }
  45. }
  46. _getValue(option, value) {
  47. return option === undefined ? value : option;
  48. }
  49. _getFileSystemMethods(methods = {}) {
  50. return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
  51. }
  52. }
  53. exports.default = Settings;