minimatch

  • Version 10.1.1
  • Published
  • 449 kB
  • 1 dependency
  • BlueOak-1.0.0 license

Install

npm i minimatch
yarn add minimatch
pnpm add minimatch

Overview

a glob matcher in javascript

Index

Variables

variable GLOBSTAR

const GLOBSTAR: Symbol;

    variable minimatch

    const minimatch: {
    (p: string, pattern: string, options?: MinimatchOptions): boolean;
    sep: Sep;
    GLOBSTAR: typeof GLOBSTAR;
    filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
    defaults: (def: MinimatchOptions) => typeof minimatch;
    braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
    makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
    match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
    AST: typeof AST;
    Minimatch: typeof Minimatch;
    escape: (
    s: string,
    {
    windowsPathsNoEscape,
    magicalBraces,
    }?: Pick<MinimatchOptions, 'windowsPathsNoEscape' | 'magicalBraces'>
    ) => string;
    unescape: (
    s: string,
    {
    windowsPathsNoEscape,
    magicalBraces,
    }?: Pick<MinimatchOptions, 'windowsPathsNoEscape' | 'magicalBraces'>
    ) => string;
    };

      variable sep

      const sep: Sep;

        Functions

        function braceExpand

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

          function defaults

          defaults: (def: MinimatchOptions) => typeof minimatch;

            function escape

            escape: (
            s: string,
            {
            windowsPathsNoEscape,
            magicalBraces,
            }?: Pick<MinimatchOptions, 'windowsPathsNoEscape' | 'magicalBraces'>
            ) => string;
            • Escape all magic characters in a glob pattern.

              If the MinimatchOptions.windowsPathsNoEscape option is used, then characters are escaped by wrapping in [], because a magic character wrapped in a character class can only be satisfied by that exact character. In this mode, \ is _not_ escaped, because it is not interpreted as a magic character, but instead as a path separator.

              If the MinimatchOptions.magicalBraces option is used, then braces ({ and }) will be escaped.

            function filter

            filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;

              function makeRe

              makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;

                function match

                match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];

                  function unescape

                  unescape: (
                  s: string,
                  {
                  windowsPathsNoEscape,
                  magicalBraces,
                  }?: Pick<MinimatchOptions, 'windowsPathsNoEscape' | 'magicalBraces'>
                  ) => string;
                  • Un-escape a string that has been escaped with escape.

                    If the MinimatchOptions.windowsPathsNoEscape option is used, then square-bracket escapes are removed, but not backslash escapes.

                    For example, it will turn the string '[*]' into *, but it will not turn '\\*' into '*', because \ is a path separator in windowsPathsNoEscape mode.

                    When windowsPathsNoEscape is not set, then both square-bracket escapes and backslash escapes are removed.

                    Slashes (and backslashes in windowsPathsNoEscape mode) cannot be escaped or unescaped.

                    When magicalBraces is not set, escapes of braces ({ and }) will not be unescaped.

                  Classes

                  class AST

                  class AST {}

                    constructor

                    constructor(type: ExtglobType, parent?: AST, options?: MinimatchOptions);

                      property hasMagic

                      readonly hasMagic: boolean;

                        property options

                        readonly options: MinimatchOptions;

                          property type

                          type: ExtglobType;

                            method clone

                            clone: (parent: AST) => AST;

                              method copyIn

                              copyIn: (part: AST | string) => void;

                                method fromGlob

                                static fromGlob: (pattern: string, options?: MinimatchOptions) => AST;

                                  method isEnd

                                  isEnd: () => boolean;

                                    method isStart

                                    isStart: () => boolean;

                                      method push

                                      push: (...parts: (string | AST)[]) => void;

                                        method toJSON

                                        toJSON: () => any[];

                                          method toMMPattern

                                          toMMPattern: () => MMRegExp | string;

                                            method toRegExpSource

                                            toRegExpSource: (
                                            allowDot?: boolean
                                            ) => [re: string, body: string, hasMagic: boolean, uflag: boolean];

                                              method toString

                                              toString: () => string;

                                                class Minimatch

                                                class Minimatch {}

                                                  constructor

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

                                                    property comment

                                                    comment: boolean;

                                                      property empty

                                                      empty: boolean;

                                                        property globParts

                                                        globParts: string[][];

                                                          property globSet

                                                          globSet: string[];

                                                            property isWindows

                                                            isWindows: boolean;

                                                              property negate

                                                              negate: boolean;

                                                                property nocase

                                                                nocase: boolean;

                                                                  property nonegate

                                                                  nonegate: boolean;

                                                                    property options

                                                                    options: MinimatchOptions;

                                                                      property partial

                                                                      partial: boolean;

                                                                        property pattern

                                                                        pattern: string;

                                                                          property platform

                                                                          platform: Platform;

                                                                            property preserveMultipleSlashes

                                                                            preserveMultipleSlashes: boolean;

                                                                              property regexp

                                                                              regexp: false | MMRegExp;

                                                                                property set

                                                                                set: ParseReturnFiltered[][];

                                                                                  property windowsNoMagicRoot

                                                                                  windowsNoMagicRoot: boolean;

                                                                                    property windowsPathsNoEscape

                                                                                    windowsPathsNoEscape: boolean;

                                                                                      method adjascentGlobstarOptimize

                                                                                      adjascentGlobstarOptimize: (globParts: string[][]) => string[][];

                                                                                        method braceExpand

                                                                                        braceExpand: () => string[];

                                                                                          method debug

                                                                                          debug: (..._: any[]) => void;

                                                                                            method defaults

                                                                                            static defaults: (def: MinimatchOptions) => typeof Minimatch;

                                                                                              method firstPhasePreProcess

                                                                                              firstPhasePreProcess: (globParts: string[][]) => string[][];

                                                                                                method hasMagic

                                                                                                hasMagic: () => boolean;

                                                                                                  method levelOneOptimize

                                                                                                  levelOneOptimize: (globParts: string[][]) => string[][];

                                                                                                    method levelTwoFileOptimize

                                                                                                    levelTwoFileOptimize: (parts: string | string[]) => string[];

                                                                                                      method make

                                                                                                      make: () => void;

                                                                                                        method makeRe

                                                                                                        makeRe: () => false | MMRegExp;

                                                                                                          method match

                                                                                                          match: (f: string, partial?: boolean) => boolean;

                                                                                                            method matchOne

                                                                                                            matchOne: (file: string[], pattern: ParseReturn[], partial?: boolean) => boolean;

                                                                                                              method parse

                                                                                                              parse: (pattern: string) => ParseReturn;

                                                                                                                method parseNegate

                                                                                                                parseNegate: () => void;

                                                                                                                  method partsMatch

                                                                                                                  partsMatch: (
                                                                                                                  a: string[],
                                                                                                                  b: string[],
                                                                                                                  emptyGSMatch?: boolean
                                                                                                                  ) => false | string[];

                                                                                                                    method preprocess

                                                                                                                    preprocess: (globParts: string[][]) => string[][];

                                                                                                                      method secondPhasePreProcess

                                                                                                                      secondPhasePreProcess: (globParts: string[][]) => string[][];

                                                                                                                        method slashSplit

                                                                                                                        slashSplit: (p: string) => string[];

                                                                                                                          Interfaces

                                                                                                                          interface MinimatchOptions

                                                                                                                          interface MinimatchOptions {}

                                                                                                                            property allowWindowsEscape

                                                                                                                            allowWindowsEscape?: boolean;

                                                                                                                              property debug

                                                                                                                              debug?: boolean;

                                                                                                                                property dot

                                                                                                                                dot?: boolean;

                                                                                                                                  property flipNegate

                                                                                                                                  flipNegate?: boolean;

                                                                                                                                    property magicalBraces

                                                                                                                                    magicalBraces?: boolean;

                                                                                                                                      property matchBase

                                                                                                                                      matchBase?: boolean;

                                                                                                                                        property nobrace

                                                                                                                                        nobrace?: boolean;

                                                                                                                                          property nocase

                                                                                                                                          nocase?: boolean;

                                                                                                                                            property nocaseMagicOnly

                                                                                                                                            nocaseMagicOnly?: boolean;

                                                                                                                                              property nocomment

                                                                                                                                              nocomment?: boolean;

                                                                                                                                                property noext

                                                                                                                                                noext?: boolean;

                                                                                                                                                  property noglobstar

                                                                                                                                                  noglobstar?: boolean;

                                                                                                                                                    property nonegate

                                                                                                                                                    nonegate?: boolean;

                                                                                                                                                      property nonull

                                                                                                                                                      nonull?: boolean;

                                                                                                                                                        property optimizationLevel

                                                                                                                                                        optimizationLevel?: number;

                                                                                                                                                          property partial

                                                                                                                                                          partial?: boolean;

                                                                                                                                                            property platform

                                                                                                                                                            platform?: Platform;

                                                                                                                                                              property preserveMultipleSlashes

                                                                                                                                                              preserveMultipleSlashes?: boolean;

                                                                                                                                                                property windowsNoMagicRoot

                                                                                                                                                                windowsNoMagicRoot?: boolean;

                                                                                                                                                                  property windowsPathsNoEscape

                                                                                                                                                                  windowsPathsNoEscape?: boolean;

                                                                                                                                                                    Type Aliases

                                                                                                                                                                    type MMRegExp

                                                                                                                                                                    type MMRegExp = RegExp & {
                                                                                                                                                                    _src?: string;
                                                                                                                                                                    _glob?: string;
                                                                                                                                                                    };

                                                                                                                                                                      type ParseReturn

                                                                                                                                                                      type ParseReturn = ParseReturnFiltered | false;

                                                                                                                                                                        type ParseReturnFiltered

                                                                                                                                                                        type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR;

                                                                                                                                                                          type Platform

                                                                                                                                                                          type Platform =
                                                                                                                                                                          | 'aix'
                                                                                                                                                                          | 'android'
                                                                                                                                                                          | 'darwin'
                                                                                                                                                                          | 'freebsd'
                                                                                                                                                                          | 'haiku'
                                                                                                                                                                          | 'linux'
                                                                                                                                                                          | 'openbsd'
                                                                                                                                                                          | 'sunos'
                                                                                                                                                                          | 'win32'
                                                                                                                                                                          | 'cygwin'
                                                                                                                                                                          | 'netbsd';

                                                                                                                                                                            type Sep

                                                                                                                                                                            type Sep = '\\' | '/';

                                                                                                                                                                              Package Files (4)

                                                                                                                                                                              Dependencies (1)

                                                                                                                                                                              Dev Dependencies (6)

                                                                                                                                                                              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/minimatch.

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