Skip to content

Function: toPattern()

toPattern(pattern, options?): Predicate<string, string> | undefined

Compile ONE pattern into a predicate, or undefined when the entry is empty or an unparseable regex literal.

Callers that want a whole list should use toPatternMatcher; this is exported for the case where a consumer applies its own semantics to some shapes and only wants the glob/regex handling (the email gate’s bare-domain shortcut, for one).

string

PatternOptions = {}

Predicate<string, string> | undefined