(label, value, minValue, maxValue)
| 13 | |
| 14 | /* Validate value for min max range */ |
| 15 | export function minMaxValidator(label, value, minValue, maxValue) { |
| 16 | if((_.isUndefined(value) || _.isNull(value) || String(value) === '')) |
| 17 | return null; |
| 18 | |
| 19 | if((!_.isUndefined(minValue) && isNaN(minValue)) || (!_.isUndefined(maxValue) && isNaN(maxValue))) { |
| 20 | return pgAdmin.Browser.messages.INVALID_MIN_MAX; |
| 21 | } else if (!_.isUndefined(minValue) && (value < minValue || value === '-')) { |
| 22 | return sprintf(pgAdmin.Browser.messages.MUST_GR_EQ, label, minValue); |
| 23 | } else if (!_.isUndefined(maxValue) && value > maxValue) { |
| 24 | return sprintf(pgAdmin.Browser.messages.MUST_LESS_EQ, label, maxValue); |
| 25 | } |
| 26 | return null; |
| 27 | } |
| 28 | |
| 29 | /* Validate value to check if it is a number */ |
| 30 | export function numberValidator(label, value) { |
no test coverage detected