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() {
9
9
message : 'Enter your name (letters and spaces only)' ,
10
10
initialValue : 'John123' , // Invalid initial value with numbers
11
11
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' ;
13
13
return undefined ;
14
14
} ,
15
15
} ) ;
@@ -25,7 +25,7 @@ async function main() {
25
25
message : 'Enter another name (letters and spaces only)' ,
26
26
initialValue : 'John Doe' , // Valid initial value
27
27
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' ;
29
29
return undefined ;
30
30
} ,
31
31
} ) ;
You can’t perform that action at this time.
0 commit comments