mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed the following code smells:
1. Use concise character class syntax
2. Add a "break" statement or remove this "else" clause.
3. Replace this generic exception class with a more specific one.
4. Use a regular expression literal instead of the 'RegExp' constructor.
5. Use the opposite operator ("not in") instead.
This commit is contained in:
committed by
Akshay Joshi
parent
d967d5046d
commit
cbf5886430
@@ -859,15 +859,13 @@ define([
|
||||
return null;
|
||||
},
|
||||
number_validate: function(value, field) {
|
||||
let pattern = new RegExp('^-?[0-9]+(\.?[0-9]*)?$');
|
||||
if (!pattern.test(value)) {
|
||||
if (!/^-?[0-9]+(\.?[0-9]*)?$/.test(value)) {
|
||||
return pgadminUtils.sprintf(pgAdmin.Browser.messages.MUST_BE_NUM, field.label);
|
||||
}
|
||||
return this.check_min_max(value, field);
|
||||
},
|
||||
integer_validate: function(value, field) {
|
||||
let pattern = new RegExp('^-?[0-9]*$');
|
||||
if (!pattern.test(value)) {
|
||||
if (!/^-?[0-9]*$/.test(value)) {
|
||||
return pgadminUtils.sprintf(pgAdmin.Browser.messages.MUST_BE_INT, field.label);
|
||||
}
|
||||
return this.check_min_max(value, field);
|
||||
|
||||
Reference in New Issue
Block a user