redis-smq
Version:
A high-performance, reliable, and scalable message queue for Node.js.
13 lines • 535 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateRedisKey = validateRedisKey;
const index_js_1 = require("../../../errors/index.js");
function validateRedisKey(key) {
if (!(key === null || key === void 0 ? void 0 : key.length))
return new index_js_1.InvalidRedisKeyError();
const valid = /^[a-z][a-z0-9\-_.]*$/.test(key.toLowerCase());
if (!valid)
return new index_js_1.InvalidRedisKeyError();
return key.toLowerCase();
}
//# sourceMappingURL=validator.js.map