minimatch
- Version 11.0.2
- Published
- 421 kB
- 2 dependencies
- BlueOak-1.0.0 license
Install
npm i minimatchyarn add minimatchpnpm add minimatchOverview
a glob matcher in javascript
Index
Variables
Functions
Classes
Minimatch
- adjascentGlobstarOptimize()
- braceExpand()
- comment
- defaults()
- empty
- firstPhasePreProcess()
- globParts
- globSet
- hasMagic()
- isWindows
- levelOneOptimize()
- make()
- match()
- maxGlobstarRecursion
- mergeRows()
- negate
- nocase
- nonegate
- options
- parse()
- parseNegate()
- partial
- partsMatch()
- pattern
- platform
- preprocess()
- preserveMultipleSlashes
- secondPhasePreProcess()
- set
- windowsNoMagicRoot
- windowsPathsNoEscape
Interfaces
Type Aliases
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[]; match: (list: string[], pattern: string, options?: MinimatchOptions) => string[]; 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 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 inwindowsPathsNoEscapemode.When
windowsPathsNoEscapeis not set, then both square-bracket escapes and backslash escapes are removed.Slashes (and backslashes in
windowsPathsNoEscapemode) cannot be escaped or unescaped.When
magicalBracesis not set, escapes of braces ({and}) will not be unescaped.
Classes
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 maxGlobstarRecursion
maxGlobstarRecursion: number;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 set
set: any[][];property windowsNoMagicRoot
windowsNoMagicRoot: boolean;property windowsPathsNoEscape
windowsPathsNoEscape: boolean;method adjascentGlobstarOptimize
adjascentGlobstarOptimize: (globParts: string[][]) => string[][];method braceExpand
braceExpand: () => string[];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 make
make: () => void;method match
match: (f: string, partial?: boolean) => boolean;method mergeRows
mergeRows: () => void;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[][];Interfaces
interface MinimatchOptions
interface MinimatchOptions {}property allowWindowsEscape
allowWindowsEscape?: boolean;inverse of MinimatchOptions.windowsPathsNoEscape
Deprecated
property braceExpandMax
braceExpandMax?: number;max number of
{...}patterns to expand. Default 100_000.At
optimizationLevel2 or higher, this also limits the patterns made when**is followed by...
property dot
dot?: boolean;allow matches that start with
.even if the pattern does not
property flipNegate
flipNegate?: boolean;invert the results of negated matches
property magicalBraces
magicalBraces?: boolean;consider braces to be "magic" for the purpose of
hasMagic
property matchBase
matchBase?: boolean;If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example,
a?bwould match the path/xyz/123/acb, but not/xyz/acb/123.
property maxGlobstarRecursion
maxGlobstarRecursion?: number;Max number of non-adjacent
**patterns to recursively walk down.The default of 200 is almost certainly high enough for most purposes, and can handle absurdly excessive patterns.
property nobrace
nobrace?: boolean;do not expand
{x,y}style braces
property nocase
nocase?: boolean;ignore case
property nocaseMagicOnly
nocaseMagicOnly?: boolean;ignore case only in wildcard patterns
property nocomment
nocomment?: boolean;do not treat patterns starting with
#as a comment
property noext
noext?: boolean;do not expand extglobs like
+(a|b)
property noglobstar
noglobstar?: boolean;treat
**the same as*
property nonegate
nonegate?: boolean;do not treat patterns starting with
!as a negation
property nonull
nonull?: boolean;return the pattern if nothing matches
property normalize
normalize?: boolean | Form;Normalize unicode in the pattern and in each portion of the tested paths, with this form.
truemeans'NFC'.
property optimizationLevel
optimizationLevel?: number;A number indicating the level of optimization that should be done to the pattern prior to parsing and using it for matches.
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.
property platform
platform?: Platform;operating system platform
property preserveMultipleSlashes
preserveMultipleSlashes?: boolean;do not collapse multiple
/into a single/
property windowsNoMagicRoot
windowsNoMagicRoot?: boolean;When a pattern starts with a UNC path or drive letter, and in
nocase:truemode, do not convert the root portions of the pattern into a case-insensitive regular expression, and instead leave them as strings.This is the default when the platform is
win32andnocase:trueis set.
property windowsPathsNoEscape
windowsPathsNoEscape?: boolean;treat
\\as a path separator, not an escape character
Type Aliases
type GlobstarParts
type GlobstarParts = { head: ParseReturn[]; body: ParseReturn[]; tail: ParseReturn[]; segments: [segment: ParseReturn[], need: number][];};A pattern row split on its first and last
**, from a start index. Each body segment has the number of path portions that it and the ones after it need, to find the last index where it can start in a path.
type ParseReturn
type ParseReturn = ParseReturnFiltered | false;type ParseReturnFiltered
type ParseReturnFiltered = string | Matcher | typeof GLOBSTAR;type PathSeps
type PathSeps = '/' | '\\' | 'both';The separators that a path has: only
/, only\(a Windows path with no/), or both. Scanning for the ones it has is faster.
type Platform
type Platform = | 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';type RowShape
type RowShape = 'tail' | 'mid' | 'head' | 'base';The rows that Minimatch#match can match without splitting the path:
**and one more portion (tail), a portion with**on each side of it (mid), a portion and then**(head), or one portion that matches the basename of the path, with matchBase (base).
type Sep
type Sep = '\\' | '/';type SplitPath
type SplitPath = { f: string; isWindows: boolean; preserveMultipleSlashes: boolean; normalize: Form | undefined; parts: string[]; resolved?: string[];};A path that Minimatch#match split, with the settings that the split depends on.
resolvedis the parts after optimizationLevel 2 has resolved.and..in them, which only depends on the same settings, once a level 2 Minimatch has needed them.
Package Files (3)
Dependencies (2)
Dev Dependencies (8)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto 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[](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>
- Updated .
Package analyzed in 4037 ms. - Missing or incorrect documentation? Open an issue for this package.
