Skip to content

glob

Matches strings with compiled glob patterns using wax.

This module is for side-effect-free glob matching. It does not walk the filesystem and does not overlap with the traversal APIs in fs.

Types

Type Description
Glob Compiled glob matcher.

Functions

matches pattern value

Tests whether value matches a glob pattern.

pattern may be either a Glob or a str. Passing a str compiles it for that call only.

Parameters:

Name Type Description
pattern Glob|str Glob object or pattern text
value str Candidate string to test

Returns: bool indicating whether the value matches.

let png = glob.Glob "**/*.png"

assert (glob.matches png "assets/logo.png")
assert (glob.matches "**/*.png" "assets/logo.png")
assert (!(glob.matches "**/*.png" "assets/logo.jpg"))