veko doc
Self-Contained API Reference • Gradual Types • Capabilities • Wasm Sandbox

glob

lib/glob.vk

lib/glob.vk Pure-Veko linear-time glob pattern matcher (*, **, ?, [a-z], [!a-z]). Zero capabilities required.

signature
match? = fn [pattern str, target str] bool

Matches target against glob pattern (* matches non-/, ** matches across /, ? matches one non-/, [abc]/[a-z]/[!0-9] matches a character class).

Executable Example
veko
use [glob]
a = glob/match? 'src/**/*.vk' 'src/crypto/sha256.vk'
b = glob/match? 'lib/*.vk' 'lib/sub/a.vk'
c = glob/match? 'file_[0-9].txt' 'file_7.txt'
if (not a) or b or (not c) [ err 'glob/match?' ] else [ .ok ]
signature
filter = fn [pattern str, paths block[str]] block[str]

Filters paths returning all strings matching glob pattern.