Skip to content

glob

Side-effect-free matching with compiled glob patterns.

This module does not walk the filesystem and does not overlap with the traversal APIs in fs.

Types

TypeDescription
Glob A compiled glob pattern.

Functions

matches pattern value -> Bool

Tests whether value matches a glob pattern.

Passing pattern text compiles it for this call only.

Parameters

NameTypeDescription
pattern (Glob | Str) Glob object or pattern text.
value Str Candidate string to test.

Example

let png = Glob "**/*.png"
assert (matches png "assets/logo.png")
assert (matches "**/*.png" "assets/logo.png")
assert (!(matches "**/*.png" "assets/logo.jpg"))