MCPcopy Create free account
hub / github.com/avoidwork/tenso / convertPatternToRegex

Function convertPatternToRegex

src/utils/auth.js:82–88  ·  view source on GitHub ↗

* Converts a pattern string to a regex pattern with wildcard handling * @param {string} pattern - The pattern string * @param {string} loginUri - The login URI to compare against * @returns {string} The converted regex pattern

(pattern, loginUri)

Source from the content-addressed store, hash-verified

80 * @returns {string} The converted regex pattern
81 */
82function convertPatternToRegex (pattern, loginUri) {
83 if (pattern === loginUri) {
84 return `^${EMPTY}(/|$)`;
85 }
86
87 return `^${pattern.replace(/\.\*/g, WILDCARD).replace(/\*/g, `${PERIOD}${WILDCARD}`)}(/|$)`;
88}
89
90/**
91 * Configures authentication middleware and strategies for the server

Callers 1

authFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected