laravel-precognition
Advanced tools
Comparing version 0.5.7 to 0.5.8
@@ -87,3 +87,3 @@ import { isAxiosError, isCancel, default as Axios } from 'axios'; | ||
return statusHandler(payload) ?? payload; | ||
}, error => { | ||
}, (error) => { | ||
if (isNotServerGeneratedError(error)) { | ||
@@ -90,0 +90,0 @@ return Promise.reject(error); |
@@ -47,3 +47,3 @@ import { debounce, isEqual, get, set, omit, merge } from 'lodash-es'; | ||
const uniqueNames = [...new Set(value)]; | ||
if (validated.length !== uniqueNames.length || !uniqueNames.every(name => validated.includes(name))) { | ||
if (validated.length !== uniqueNames.length || !uniqueNames.every((name) => validated.includes(name))) { | ||
validated = uniqueNames; | ||
@@ -57,3 +57,3 @@ return listeners.validatedChanged; | ||
*/ | ||
const valid = () => validated.filter(name => typeof errors[name] === 'undefined'); | ||
const valid = () => validated.filter((name) => typeof errors[name] === 'undefined'); | ||
/** | ||
@@ -71,3 +71,3 @@ * Touched input state. | ||
const uniqueNames = [...new Set(value)]; | ||
if (touched.length !== uniqueNames.length || !uniqueNames.every(name => touched.includes(name))) { | ||
if (touched.length !== uniqueNames.length || !uniqueNames.every((name) => touched.includes(name))) { | ||
touched = uniqueNames; | ||
@@ -190,3 +190,3 @@ return listeners.touchedChanged; | ||
...setErrors(merge(omit({ ...errors }, validate), response.data.errors)), | ||
].forEach(listener => listener()); | ||
].forEach((listener) => listener()); | ||
return config.onValidationError | ||
@@ -197,3 +197,3 @@ ? config.onValidationError(response, axiosError) | ||
onSuccess: (response) => { | ||
setValidated([...validated, ...validate]).forEach(listener => listener()); | ||
setValidated([...validated, ...validate]).forEach((listener) => listener()); | ||
return config.onSuccess | ||
@@ -207,3 +207,3 @@ ? config.onSuccess(response) | ||
...setErrors(omit({ ...errors }, validate)), | ||
].forEach(listener => listener()); | ||
].forEach((listener) => listener()); | ||
return config.onPrecognitionSuccess | ||
@@ -229,7 +229,7 @@ ? config.onPrecognitionSuccess(response) | ||
onStart: () => { | ||
setValidating(true).forEach(listener => listener()); | ||
setValidating(true).forEach((listener) => listener()); | ||
(config.onStart ?? (() => null))(); | ||
}, | ||
onFinish: () => { | ||
setValidating(false).forEach(listener => listener()); | ||
setValidating(false).forEach((listener) => listener()); | ||
oldTouched = validatingTouched; | ||
@@ -256,3 +256,3 @@ oldData = validatingData; | ||
if (get(oldData, name) !== value) { | ||
setTouched([name, ...touched]).forEach(listener => listener()); | ||
setTouched([name, ...touched]).forEach((listener) => listener()); | ||
} | ||
@@ -284,3 +284,3 @@ validator(config ?? {}); | ||
: [resolveName(input)]; | ||
setTouched([...touched, ...inputs]).forEach(listener => listener()); | ||
setTouched([...touched, ...inputs]).forEach((listener) => listener()); | ||
return form; | ||
@@ -293,7 +293,7 @@ }, | ||
setErrors(value) { | ||
setErrors(value).forEach(listener => listener()); | ||
setErrors(value).forEach((listener) => listener()); | ||
return form; | ||
}, | ||
forgetError(name) { | ||
forgetError(name).forEach(listener => listener()); | ||
forgetError(name).forEach((listener) => listener()); | ||
return form; | ||
@@ -303,7 +303,7 @@ }, | ||
if (names.length === 0) { | ||
setTouched([]).forEach(listener => listener()); | ||
setTouched([]).forEach((listener) => listener()); | ||
} | ||
else { | ||
const newTouched = [...touched]; | ||
names.forEach(name => { | ||
names.forEach((name) => { | ||
if (newTouched.includes(name)) { | ||
@@ -314,3 +314,3 @@ newTouched.splice(newTouched.indexOf(name), 1); | ||
}); | ||
setTouched(newTouched).forEach(listener => listener()); | ||
setTouched(newTouched).forEach((listener) => listener()); | ||
} | ||
@@ -367,3 +367,3 @@ return form; | ||
const newData = { ...data }; | ||
Object.keys(newData).forEach(name => { | ||
Object.keys(newData).forEach((name) => { | ||
const value = newData[name]; | ||
@@ -370,0 +370,0 @@ if (value === null) { |
{ | ||
"name": "laravel-precognition", | ||
"version": "0.5.7", | ||
"version": "0.5.8", | ||
"description": "Laravel Precognition.", | ||
@@ -38,6 +38,6 @@ "keywords": [ | ||
"@types/lodash-es": "^4.17.12", | ||
"@types/node": "^20.1.0", | ||
"@types/node": "^22.5.0", | ||
"typescript": "^5.0.0", | ||
"vitest": "^1.6.0" | ||
"vitest": "^2.0.5" | ||
} | ||
} |
29147