Options
All
  • Public
  • Public/Protected
  • All
Menu

External module utils/matcher

Helper functions to manipulate Minimatch patterns.

Index

Classes

Functions

Functions

asString

  • asString(matcher: minimatch.IMinimatch): string
  • Converts a parsed Minimatch pattern back to a string.

    Parameters

    • matcher: minimatch.IMinimatch

      Parsed Minimatch pattern to stringify.

    Returns string

    String corresponding to matcher.

join

  • join(prefix: string, matcher: minimatch.IMinimatch): minimatch.IMinimatch
  • Joins a prefix (POSIX path) with a parsed Minimatch pattern.

    It can be used to restrict a Minimatch pattern to a subdirectory:

    const jsFiles = new Minimatch("**\/*.js");
    const jsFilesInBuildExample = join("build/example", jsFiles);

    This acts as a generalization of Node's path.join over Minimatch patterns.

    If the Minimatch pattern is a comment or can be interpreted as an absolute POSIX path (ie. starts with /), an unprefixed copy of matcher is returned.

    Parameters

    • prefix: string

      Left side of the join, must be a POSIX path (relative or absolute)

    • matcher: minimatch.IMinimatch

      Parsed Minimatch pattern.

    Returns minimatch.IMinimatch

    New Minimatch pattern resulting from joining prefix with matcher.

Generated using TypeDoc