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 wbkCheckString( val, min, max ) { 14 if ( val.length < min || val.length > max ) { 15 return false; 16 } else { 17 return true; 18 } 19} 20// check email 21function wbkCheckEmail( val ) { 22var re = /^(([^<>()\[\]\\.,;:\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,}))$/; 23if ( val == '' || !re.test(val) ){ 24 return false; 25} 26return true; 27 28} 29// check interger range 30function wbkCheckIntegerMinMax( val, min, max ) { 31 val = parseInt( val ); 32 min = parseInt( min ); 33 max = parseInt( max ); 34 35 if ( val < min || val > max ) { 36 return false; 37 } else { 38 return true; 39 } 40} 41// check phone 42function wbkCheckPhone( val ) { 43 var pattern = new RegExp(/^[(]{0,1}[0-9]{3}[)]{0,1}[-\s\.]{0,1}[0-9]{3}[-\s\.]{0,1}[0-9]{4}$/); 44 return pattern.test(val); 45} 46// check price 47function wbkCheckPrice( val ) { 48 if( val == '' ){ 49 return false; 50 } 51 if( wbkCheckInteger( val ) ){ 52 if ( wbkCheckIntegerMinMax( val, 0, 9999999 ) ){ 53 return true; 54 } 55 } 56 if( wbkCheckFloat( val ) ){ 57 if ( val >= 0 || val <= 9999999 ) { 58 return true; 59 } 60 } 61 return false; 62}
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.