MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / numberValidator

Function numberValidator

web/pgadmin/static/js/validators.js:30–37  ·  view source on GitHub ↗
(label, value)

Source from the content-addressed store, hash-verified

28
29/* Validate value to check if it is a number */
30export function numberValidator(label, value) {
31 if((_.isUndefined(value) || _.isNull(value) || String(value) === ''))
32 return null;
33 if (!/^-?\d+(\.?\d*)$/.test(value)) {
34 return sprintf(pgAdmin.Browser.messages.MUST_BE_NUM, label);
35 }
36 return null;
37}
38
39/* Validate value to check if it is an integer */
40export function integerValidator(label, value) {

Callers 1

validateSchemaFunction · 0.90

Calls 2

sprintfFunction · 0.90
testMethod · 0.80

Tested by

no test coverage detected