Philipp Horstenkamp ff32b18cc4
Some checks failed
Auto Maintenance Cycle / pre-commit Autoupdate (push) Failing after 34s
Adding the rest back in.
2023-11-19 03:47:39 +01:00

17 lines
359 B
JavaScript

'use strict'
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]
}