You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

4 years ago
  1. interface Ignore {
  2. /**
  3. * Adds a rule rules to the current manager.
  4. * @param {string | Ignore} pattern
  5. * @returns IgnoreBase
  6. */
  7. add(pattern: string | Ignore): Ignore
  8. /**
  9. * Adds several rules to the current manager.
  10. * @param {string[]} patterns
  11. * @returns IgnoreBase
  12. */
  13. add(patterns: (string | Ignore)[]): Ignore
  14. /**
  15. * Filters the given array of pathnames, and returns the filtered array.
  16. * NOTICE that each path here should be a relative path to the root of your repository.
  17. * @param paths the array of paths to be filtered.
  18. * @returns The filtered array of paths
  19. */
  20. filter(paths: string[]): string[]
  21. /**
  22. * Creates a filter function which could filter
  23. * an array of paths with Array.prototype.filter.
  24. */
  25. createFilter(): (path: string) => boolean
  26. /**
  27. * Returns Boolean whether pathname should be ignored.
  28. * @param {string} pathname a path to check
  29. * @returns boolean
  30. */
  31. ignores(pathname: string): boolean
  32. }
  33. /**
  34. * Creates new ignore manager.
  35. */
  36. declare function ignore(): Ignore
  37. export default ignore