PPM - Path Pattern Matcher
Official sources are open to Staxis GitLab group members: how to join and view the code.
> Repository: π go to: dev space -> ppm
> Latest version: π go to: tags
> Stable release: π go to: releases
Description
PPM is an official Staxis library for matching URL-like and filesystem-like paths against routing rules.
What it does
ppmatch is a shared utility used by several layers. It compares an input path against one or more rules and returns a boolean result, providing path matching without a full router.
The matcher supports:
- * as wildcard
-
^ only at the start of a rule
-
$ only at the end of a rule
-
full path matching when the rule contains /
-
segment matching when the rule is a plain token
Files Map
| File | Purpose |
|---|---|
manifest.json | Declares the library identity |
main.js | Implements pathPatternMatch(inputPath, rules) |
configs.js | Empty placeholder for local settings |
readme.md | Quick reference for the pack |
Requirements
- No required pack dependencies
- No external npm dependencies
- Open library access through libraries.require('ppmatch')
Configurations
There is no runtime configuration for this library.
Rules are passed at call time, so behavior is fully driven by the input path and the rules array you provide.
How To Use
Load the library and match a URL against a set of rules:
const ppmatch = libraries.require('ppmatch')
const ok = ppmatch.pathPatternMatch(
'/admin/users?id=1',
[
'^/admin/*',
'/health$'
]
)
Use a slash in the rule when you want to match the whole path. Use a plain token when you want to match by segment.
Documentation
This page is the HTML adaptation of the pack's README.md, with practical clarifications checked against the implementation. Complete Staxis onboarding to request GitLab access to the official sources.