pattern.d.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /// <reference types="micromatch" />
  2. import micromatch = require('micromatch');
  3. import { Pattern, PatternRe } from '../types/patterns';
  4. /**
  5. * Return true for static pattern.
  6. */
  7. export declare function isStaticPattern(pattern: Pattern): boolean;
  8. /**
  9. * Return true for pattern that looks like glob.
  10. */
  11. export declare function isDynamicPattern(pattern: Pattern): boolean;
  12. /**
  13. * Convert a windows «path» to a unix-style «path».
  14. */
  15. export declare function unixifyPattern(pattern: Pattern): Pattern;
  16. /**
  17. * Returns negative pattern as positive pattern.
  18. */
  19. export declare function convertToPositivePattern(pattern: Pattern): Pattern;
  20. /**
  21. * Returns positive pattern as negative pattern.
  22. */
  23. export declare function convertToNegativePattern(pattern: Pattern): Pattern;
  24. /**
  25. * Return true if provided pattern is negative pattern.
  26. */
  27. export declare function isNegativePattern(pattern: Pattern): boolean;
  28. /**
  29. * Return true if provided pattern is positive pattern.
  30. */
  31. export declare function isPositivePattern(pattern: Pattern): boolean;
  32. /**
  33. * Extracts negative patterns from array of patterns.
  34. */
  35. export declare function getNegativePatterns(patterns: Pattern[]): Pattern[];
  36. /**
  37. * Extracts positive patterns from array of patterns.
  38. */
  39. export declare function getPositivePatterns(patterns: Pattern[]): Pattern[];
  40. /**
  41. * Extract base directory from provided pattern.
  42. */
  43. export declare function getBaseDirectory(pattern: Pattern): string;
  44. /**
  45. * Return true if provided pattern has globstar.
  46. */
  47. export declare function hasGlobStar(pattern: Pattern): boolean;
  48. /**
  49. * Return true if provided pattern ends with slash and globstar.
  50. */
  51. export declare function endsWithSlashGlobStar(pattern: Pattern): boolean;
  52. /**
  53. * Returns «true» when pattern ends with a slash and globstar or the last partial of the pattern is static pattern.
  54. */
  55. export declare function isAffectDepthOfReadingPattern(pattern: Pattern): boolean;
  56. /**
  57. * Return naive depth of provided pattern.
  58. */
  59. export declare function getDepth(pattern: Pattern): number;
  60. /**
  61. * Make RegExp for provided pattern.
  62. */
  63. export declare function makeRe(pattern: Pattern, options: micromatch.Options): PatternRe;
  64. /**
  65. * Convert patterns to regexps.
  66. */
  67. export declare function convertPatternsToRe(patterns: Pattern[], options: micromatch.Options): PatternRe[];
  68. /**
  69. * Returns true if the entry match any of the given RegExp's.
  70. */
  71. export declare function matchAny(entry: string, patternsRe: PatternRe[]): boolean;