Fixed SonarQube issues.

This commit is contained in:
Aditya Toshniwal
2022-09-12 11:28:00 +05:30
committed by Akshay Joshi
parent 76a6feb2e7
commit 93f5fbc797
6 changed files with 34 additions and 153 deletions

View File

@@ -27,7 +27,7 @@ export function minMaxValidator(label, value, minValue, maxValue) {
export function numberValidator(label, value) {
if((_.isUndefined(value) || _.isNull(value) || String(value) === ''))
return null;
if (!/^-?[0-9]+(\.?[0-9]*)?$/.test(value)) {
if (!/^-?\d+(\.?\d*)$/.test(value)) {
return sprintf(pgAdmin.Browser.messages.MUST_BE_NUM, label);
}
return null;
@@ -37,7 +37,7 @@ export function numberValidator(label, value) {
export function integerValidator(label, value) {
if((_.isUndefined(value) || _.isNull(value) || String(value) === ''))
return null;
if (!/^-?[0-9]*$/.test(value)) {
if (!/^-?\d*$/.test(value)) {
return sprintf(pgAdmin.Browser.messages.MUST_BE_INT, label);
}
return null;