redis-smq
Version:
A high-performance, reliable, and scalable message queue for Node.js.
19 lines • 655 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._validateRoutingPattern = _validateRoutingPattern;
const LITERAL_TOKEN_RE = /^[A-Za-z][A-Za-z0-9]*(?:[-_][A-Za-z0-9]+)*$/;
function _validateRoutingPattern(p) {
if (typeof p !== 'string' || p.length === 0)
return false;
const tokens = p.split('.');
if (tokens.some((t) => t.length === 0))
return false;
for (const tok of tokens) {
if (tok === '*' || tok === '#')
continue;
if (!LITERAL_TOKEN_RE.test(tok))
return false;
}
return true;
}
//# sourceMappingURL=_validate-routing-pattern.js.map