mirror of
https://github.com/ASzc/change-string-case-action.git
synced 2024-11-23 23:33:50 +08:00
17 lines
359 B
JavaScript
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]
|
|
}
|