File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ async function main() {
99 message : 'Enter your name (letters and spaces only)' ,
1010 initialValue : 'John123' , // Invalid initial value with numbers
1111 validate : ( value ) => {
12- if ( ! / ^ [ a - z A - Z \s ] + $ / . test ( value ) ) return 'Name can only contain letters and spaces' ;
12+ if ( ! value || ! / ^ [ a - z A - Z \s ] + $ / . test ( value ) ) return 'Name can only contain letters and spaces' ;
1313 return undefined ;
1414 } ,
1515 } ) ;
@@ -25,7 +25,7 @@ async function main() {
2525 message : 'Enter another name (letters and spaces only)' ,
2626 initialValue : 'John Doe' , // Valid initial value
2727 validate : ( value ) => {
28- if ( ! / ^ [ a - z A - Z \s ] + $ / . test ( value ) ) return 'Name can only contain letters and spaces' ;
28+ if ( ! value || ! / ^ [ a - z A - Z \s ] + $ / . test ( value ) ) return 'Name can only contain letters and spaces' ;
2929 return undefined ;
3030 } ,
3131 } ) ;
You can’t perform that action at this time.
0 commit comments