Skip to main content

isMatch()

const isMatch: (string, pattern, options?) => boolean = micromatch.isMatch

Returns true if the specified string matches the given glob pattern.

Parameters

ParameterTypeDescription

string

string

String to match

pattern

string | readonly string[]

Glob pattern to use for matching.

options?

Options

See available options for changing how matches are performed

Returns

boolean

Returns true if the string matches the glob pattern.

Example

var mm = require('micromatch');
mm.isMatch(string, pattern[, options]);

console.log(mm.isMatch('a.a', '*.a'));
//=> true
console.log(mm.isMatch('a.b', '*.a'));
//=> false