7ac99688f48fd371842e398a17f37543e36ac5358b7985c5c3826ba85b79158e114ed8670e7d174247d68c2c9955da3a284b91de79ffbfd7974034ecd575c4 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import micromatch = require('micromatch');
  2. import { IOptions } from '../../managers/options';
  3. import { FilterFunction } from '@mrmlnc/readdir-enhanced';
  4. import { Pattern } from '../../types/patterns';
  5. export default class DeepFilter {
  6. private readonly options;
  7. private readonly micromatchOptions;
  8. constructor(options: IOptions, micromatchOptions: micromatch.Options);
  9. /**
  10. * Returns filter for directories.
  11. */
  12. getFilter(positive: Pattern[], negative: Pattern[]): FilterFunction;
  13. /**
  14. * Returns max depth of the provided patterns.
  15. */
  16. private getMaxPatternDepth;
  17. /**
  18. * Returns RegExp's for patterns that can affect the depth of reading.
  19. */
  20. private getNegativePatternsRe;
  21. /**
  22. * Returns «true» for directory that should be read.
  23. */
  24. private filter;
  25. /**
  26. * Returns «true» when the «deep» option is disabled or number and depth of the entry is greater that the option value.
  27. */
  28. private isSkippedByDeepOption;
  29. /**
  30. * Returns «true» when depth parameter is not an Infinity and entry depth greater that the parameter value.
  31. */
  32. private isSkippedByMaxPatternDepth;
  33. /**
  34. * Returns «true» for symlinked directory if the «followSymlinkedDirectories» option is disabled.
  35. */
  36. private isSkippedSymlinkedDirectory;
  37. /**
  38. * Returns «true» for a directory whose name starts with a period if «dot» option is disabled.
  39. */
  40. private isSkippedDotDirectory;
  41. /**
  42. * Returns «true» for a directory whose path math to any negative pattern.
  43. */
  44. private isSkippedByNegativePatterns;
  45. }