mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-12-24 13:14:26 +00:00
16 lines
359 B
JavaScript
16 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]
|
|
}
|