MCPcopy Create free account
hub / github.com/denoland/std / isComplexSegment

Function isComplexSegment

http/unstable_route.ts:197–203  ·  view source on GitHub ↗

* Returns true if a pathname segment contains URLPattern syntax that the * radix tree cannot model structurally — i.e. it is not a plain static * string, a bare `:param`, or a standalone `*`. * * Affected syntax: * - Optional / non-capturing groups: `{.ext}?` `{foo}` * - Regex-constrai

(segment: string)

Source from the content-addressed store, hash-verified

195 * clause. This is intentional — the two checks subsume each other for `*`.
196 */
197function isComplexSegment(segment: string): boolean {
198 if (segment.includes("{") || segment.includes("(")) return true;
199 if (segment.includes("*") && segment !== "*") return true;
200 if (segment.endsWith("?") || segment.endsWith("+")) return true;
201 if (segment.includes("\\")) return true;
202 return false;
203}
204
205function createNode(): RouteNode {
206 return {

Callers

nothing calls this directly

Calls 1

includesMethod · 0.80

Tested by

no test coverage detected