1// WEBBA Booking js validation functions 2 3// check integer 4function wbkCheckInteger(val) { 5 return /^\+?(0|[1-9]\d*)$/.test(val); 6} 7// check integer 8function wbkCheckFloat(val) { 9 return /^(?:[1-9]\d*|0)?(?:\.\d+)?$/.test(val); 10} 11 12// check string 13function wbk_check_string(val, min, max) { 14 if( val == null ){ 15 return false; 16 } 17 if (val.length < min || val.length > max) { 18 return false; 19 } else { 20 return true; 21 } 22} 23// check email 24function wbk_check_email(val) { 25 var re = 26 /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 27 if (val == '' || !re.test(val)) { 28 return false; 29 } 30 return true; 31} 32// check interger range 33function wbk_check_integer_min_max(val, min, max) { 34 val = parseInt(val); 35 min = parseInt(min); 36 max = parseInt(max); 37 38 if (val < min || val > max) { 39 return false; 40 } else { 41 return true; 42 } 43} 44 45// check phone 46function wbkCheckPhone(val) { 47 var pattern = new RegExp( 48 /^[(]{0,1}[0-9]{3}[)]{0,1}[-\s\.]{0,1}[0-9]{3}[-\s\.]{0,1}[0-9]{4}$/ 49 ); 50 return pattern.test(val); 51} 52// check price 53function wbkCheckPrice(val) { 54 if (val == '') { 55 return false; 56 } 57 if (wbkCheckInteger(val)) { 58 if (wbk_check_integer_min_max(val, 0, 9999999)) { 59 return true; 60 } 61 } 62 if (wbkCheckFloat(val)) { 63 if (val >= 0 || val <= 9999999) { 64 return true; 65 } 66 } 67 return false; 68}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.