@aikidosec/firewall
Version:
Zen by Aikido is an embedded Application Firewall that autonomously protects Node.js apps against common and critical attacks, provides rate limiting, detects malicious traffic (including bots), and more.
11 lines (10 loc) • 362 B
JavaScript
;
module.exports = function getLimit(limits, name, defaultLimit) {
if (!limits || limits[name] === undefined || limits[name] === null) {
return defaultLimit;
}
if (typeof limits[name] !== "number" || isNaN(limits[name])) {
throw new TypeError("Limit " + name + " is not a valid number");
}
return limits[name];
};