@@ -12,7 +12,7 @@ export const createForm = (config) => {
1212 let initialValues = config . initialValues || { } ;
1313
1414 const validationSchema = config . validationSchema ;
15- const validateFn = config . validate ;
15+ const validateFunction = config . validate ;
1616 const onSubmit = config . onSubmit ;
1717
1818 const getInitial = {
@@ -73,10 +73,10 @@ export const createForm = (config) => {
7373 } ) ;
7474 }
7575
76- if ( validateFn ) {
76+ if ( validateFunction ) {
7777 isValidating . set ( true ) ;
7878 return Promise . resolve ( )
79- . then ( ( ) => validateFn ( { [ field ] : value } ) )
79+ . then ( ( ) => validateFunction ( { [ field ] : value } ) )
8080 . then ( ( errs ) =>
8181 util . update ( errors , field , ! util . isNullish ( errs ) ? errs [ field ] : '' ) ,
8282 )
@@ -101,19 +101,19 @@ export const createForm = (config) => {
101101 return updateValidateField ( field , value ) ;
102102 }
103103
104- function handleSubmit ( ev ) {
105- if ( ev && ev . preventDefault ) {
106- ev . preventDefault ( ) ;
104+ function handleSubmit ( event ) {
105+ if ( event && event . preventDefault ) {
106+ event . preventDefault ( ) ;
107107 }
108108
109109 isSubmitting . set ( true ) ;
110110
111111 return util . subscribeOnce ( form ) . then ( ( values ) => {
112- if ( typeof validateFn === 'function' ) {
112+ if ( typeof validateFunction === 'function' ) {
113113 isValidating . set ( true ) ;
114114
115115 return Promise . resolve ( )
116- . then ( ( ) => validateFn ( values ) )
116+ . then ( ( ) => validateFunction ( values ) )
117117 . then ( ( error ) => {
118118 if ( util . isEmpty ( error ) ) {
119119 clearErrorsAndSubmit ( values ) ;
@@ -137,7 +137,7 @@ export const createForm = (config) => {
137137 if ( yupErrors && yupErrors . inner ) {
138138 const updatedErrors = getInitial . errors ( ) ;
139139
140- yupErrors . inner . forEach ( ( error ) =>
140+ yupErrors . inner . map ( ( error ) =>
141141 util . set ( updatedErrors , error . path , error . message ) ,
142142 ) ;
143143
0 commit comments