options.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. function prepare(options) {
  4. var opts = Object.assign({
  5. cwd: process.cwd(),
  6. deep: true,
  7. ignore: [],
  8. dot: false,
  9. stats: false,
  10. onlyFiles: true,
  11. onlyDirectories: false,
  12. followSymlinkedDirectories: true,
  13. unique: true,
  14. markDirectories: false,
  15. absolute: false,
  16. nobrace: false,
  17. brace: true,
  18. noglobstar: false,
  19. globstar: true,
  20. noext: false,
  21. extension: true,
  22. nocase: false,
  23. case: true,
  24. matchBase: false,
  25. transform: null
  26. }, options);
  27. if (opts.onlyDirectories) {
  28. opts.onlyFiles = false;
  29. }
  30. opts.brace = !opts.nobrace;
  31. opts.globstar = !opts.noglobstar;
  32. opts.extension = !opts.noext;
  33. opts.case = !opts.nocase;
  34. if (options) {
  35. opts.brace = ('brace' in options ? options.brace : opts.brace);
  36. opts.globstar = ('globstar' in options ? options.globstar : opts.globstar);
  37. opts.extension = ('extension' in options ? options.extension : opts.extension);
  38. opts.case = ('case' in options ? options.case : opts.case);
  39. }
  40. return opts;
  41. }
  42. exports.prepare = prepare;