main
Last change
on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
359 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | module.exports = function getLimit (limits, name, defaultLimit) {
|
---|
| 4 | if (
|
---|
| 5 | !limits ||
|
---|
| 6 | limits[name] === undefined ||
|
---|
| 7 | limits[name] === null
|
---|
| 8 | ) { return defaultLimit }
|
---|
| 9 |
|
---|
| 10 | if (
|
---|
| 11 | typeof limits[name] !== 'number' ||
|
---|
| 12 | isNaN(limits[name])
|
---|
| 13 | ) { throw new TypeError('Limit ' + name + ' is not a valid number') }
|
---|
| 14 |
|
---|
| 15 | return limits[name]
|
---|
| 16 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.