@types/minimatch

  • Version 5.1.2
  • Published
  • 12.5 kB
  • No dependencies
  • MIT license

Install

npm i @types/minimatch
yarn add @types/minimatch
pnpm add @types/minimatch

Overview

TypeScript definitions for minimatch

Index

Variables

variable GLOBSTAR

const GLOBSTAR: Symbol;

    variable sep

    const sep: string;

      Functions

      function braceExpand

      braceExpand: (pattern: string, options?: IOptions) => string[];

        function defaults

        defaults: (defaultOptions: IOptions) => typeof minimatch;

          function filter

          filter: (
          pattern: string,
          options?: IOptions
          ) => (element: string, indexed: number, array: readonly string[]) => boolean;
          • A function that tests its supplied argument, suitable for use with Array.filter.

            Example 1

            import minimatch = require("minimatch");

            const javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true}));

          function makeRe

          makeRe: (pattern: string, options?: IOptions) => RegExp | false;
          • Make a regular expression object from the pattern.

          function match

          match: (
          list: readonly string[],
          pattern: string,
          options?: IOptions
          ) => string[];
          • Match against the list of files, in the style of fnmatch or glob. If nothing is matched, and options.nonull is set, then return a list containing the pattern itself.

            Example 1

            import minimatch = require("minimatch");

            const javascripts = minimatch.match(fileList, "*.js", {matchBase: true});

          function minimatch

          minimatch: typeof minimatch;
          • Tests a path against the pattern using the options.

            Example 1

            import minimatch = require("minimatch");

            const isJS = minimatch(file, "*.js", { matchBase: true });

          Classes

          class Minimatch

          class Minimatch {}
          • Create a minimatch object by instantiating the minimatch.Minimatch class.

            Example 1

            import { Minimatch } from "minimatch";

            const mm = new Minimatch(pattern, options);

          constructor

          constructor(pattern: string, options?: IOptions);

            property comment

            comment: boolean;
            • True if the pattern is a comment.

            property empty

            empty: boolean;
            • True if the pattern is "".

            property negate

            negate: boolean;
            • True if the pattern is negated.

            property options

            options: IOptions;
            • The options supplied to the constructor.

            property partial

            partial: boolean;
            • True if partial paths should be compared to a pattern.

            property pattern

            pattern: string;
            • The original pattern the minimatch object represents.

            property regexp

            regexp: false | RegExp;
            • Created by the makeRe method. A single regular expression expressing the entire pattern. This is useful in cases where you wish to use the pattern somewhat like fnmatch(3) with FNM_PATH enabled.

            property set

            set: (string | RegExp)[][];
            • A 2-dimensional array of regexp or string expressions. Each row in the array corresponds to a brace-expanded pattern. Each item in the row corresponds to a single path-part. For example, the pattern {a,b/c}/d would expand to a set of patterns like:

              [ [ a, d ]
              , [ b, c, d ] ]

              If a portion of the pattern doesn't have any "magic" in it (that is, it's something like "foo"` rather than fo*o?), then it will be left as a string rather than converted to a regular expression.

            property windowsPathsNoEscape

            windowsPathsNoEscape: boolean;
            • True if windows path delimiters shouldn't be interpreted as escape characters.

            method braceExpand

            braceExpand: () => string[];
            • @deprecated. For internal use.

            method debug

            debug: () => void;
            • @deprecated. For internal use.

            method defaults

            static defaults: (defaultOptions: IOptions) => typeof Minimatch;

              method make

              make: () => void;
              • @deprecated. For internal use.

              method makeRe

              makeRe: () => RegExp | false;
              • Generate the regexp member if necessary, and return it. Will return false if the pattern is invalid.

              method match

              match: (fname: string, partial?: boolean) => boolean;
              • true if the filename matches the pattern, or false otherwise.

              method matchOne

              matchOne: (
              file: readonly string[],
              pattern: ReadonlyArray<string | RegExp>,
              partial: boolean
              ) => boolean;
              • Take a /-split filename, and match it against a single row in the regExpSet. This method is mainly for internal use, but is exposed so that it can be used by a glob-walker that needs to avoid excessive filesystem calls.

              method parse

              parse: (
              pattern: string,
              isSub?: boolean
              ) => string | false | RegExp | typeof GLOBSTAR | [string, boolean];
              • @deprecated. For internal use.

              method parseNegate

              parseNegate: () => void;
              • @deprecated. For internal use.

              Interfaces

              interface IOptions

              interface IOptions {}

                property debug

                debug?: boolean | undefined;
                • Dump a ton of stuff to stderr.

                  false

                property dot

                dot?: boolean | undefined;
                • Allow patterns to match filenames starting with a period, even if the pattern does not explicitly have a period in that spot.

                  Note that by default, 'a/**' + '/b' will **not** match a/.d/b, unless dot is set.

                  false

                property flipNegate

                flipNegate?: boolean | undefined;
                • Returns from negate expressions the same as if they were not negated. (Ie, true on a hit, false on a miss.)

                  false

                property matchBase

                matchBase?: boolean | undefined;
                • If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, a?b would match the path /xyz/123/acb, but not /xyz/acb/123.

                  false

                property nobrace

                nobrace?: boolean | undefined;
                • Do not expand {a,b} and {1..3} brace sets.

                  false

                property nocase

                nocase?: boolean | undefined;
                • Perform a case-insensitive match.

                  false

                property nocomment

                nocomment?: boolean | undefined;
                • Suppress the behavior of treating # at the start of a pattern as a comment.

                  false

                property noext

                noext?: boolean | undefined;
                • Disable "extglob" style patterns like +(a|b).

                  false

                property noglobstar

                noglobstar?: boolean | undefined;
                • Disable ** matching against multiple folder names.

                  false

                property nonegate

                nonegate?: boolean | undefined;
                • Suppress the behavior of treating a leading ! character as negation.

                  false

                property nonull

                nonull?: boolean | undefined;
                • When a match is not found by minimatch.match, return a list containing the pattern itself if this option is set. Otherwise, an empty list is returned if there are no matches.

                  false

                property partial

                partial?: boolean;
                • Compare a partial path to a pattern. As long as the parts of the path that are present are not contradicted by the pattern, it will be treated as a match. This is useful in applications where you're walking through a folder structure, and don't yet have the full path, but want to ensure that you do not walk down paths that can never be a match.

                  false

                  Example 1

                  import minimatch = require("minimatch");

                  minimatch('/a/b', '/a/*' + '/c/d', { partial: true }) // true, might be /a/b/c/d minimatch('/a/b', '/**' + '/d', { partial: true }) // true, might be /a/b/.../d minimatch('/x/y/z', '/a/**' + '/z', { partial: true }) // false, because x !== a

                property windowsPathsNoEscape

                windowsPathsNoEscape?: boolean;
                • Use \\ as a path separator _only_, and _never_ as an escape character. If set, all \\ characters are replaced with / in the pattern. Note that this makes it **impossible** to match against paths containing literal glob pattern characters, but allows matching with patterns constructed using path.join() and path.resolve() on Windows platforms, mimicking the (buggy!) behavior of earlier versions on Windows. Please use with caution, and be mindful of the caveat about Windows paths

                  For legacy reasons, this is also set if options.allowWindowsEscape is set to the exact value false.

                  false

                Type Aliases

                type IMinimatch

                type IMinimatch = Minimatch;
                • Deprecated

                  Keep legacy interface to prevent unnecessary breakage.

                type IMinimatchStatic

                type IMinimatchStatic = typeof Minimatch;
                • Deprecated

                  Keep legacy interface to prevent unnecessary breakage.

                Package Files (1)

                Dependencies (0)

                No dependencies.

                Dev Dependencies (0)

                No dev dependencies.

                Peer Dependencies (0)

                No peer dependencies.

                Badge

                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/minimatch.

                • Markdown
                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/minimatch)
                • HTML
                  <a href="https://www.jsdocs.io/package/@types/minimatch"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>