|
1 |
| -import debounce from 'lodash.debounce' |
2 |
| -import isequal from 'lodash.isequal' |
3 |
| -import get from 'lodash.get' |
4 |
| -import set from 'lodash.set' |
| 1 | +import { debounce, isEqual, get, set, omit, merge } from 'lodash-es' |
5 | 2 | import { ValidationCallback, Config, NamedInputEvent, SimpleValidationErrors, ValidationErrors, Validator as TValidator, ValidatorListeners, ValidationConfig } from './types.js'
|
6 | 3 | import { client, isFile } from './client.js'
|
7 | 4 | import { isAxiosError } from 'axios'
|
8 |
| -import omit from 'lodash.omit' |
9 |
| -import merge from 'lodash.merge' |
10 | 5 |
|
11 | 6 | export const createValidator = (callback: ValidationCallback, initialData: Record<string, unknown> = {}): TValidator => {
|
12 | 7 | /**
|
@@ -110,7 +105,7 @@ export const createValidator = (callback: ValidationCallback, initialData: Recor
|
110 | 105 | const setErrors = (value: ValidationErrors|SimpleValidationErrors): (() => void)[] => {
|
111 | 106 | const prepared = toValidationErrors(value)
|
112 | 107 |
|
113 |
| - if (! isequal(errors, prepared)) { |
| 108 | + if (! isEqual(errors, prepared)) { |
114 | 109 | errors = prepared
|
115 | 110 |
|
116 | 111 | return listeners.errorsChanged
|
@@ -225,7 +220,7 @@ export const createValidator = (callback: ValidationCallback, initialData: Recor
|
225 | 220 | },
|
226 | 221 | onBefore: () => {
|
227 | 222 | const beforeValidationResult = (config.onBeforeValidation ?? ((previous, next) => {
|
228 |
| - return ! isequal(previous, next) |
| 223 | + return ! isEqual(previous, next) |
229 | 224 | }))({ data, touched }, { data: oldData, touched: oldTouched })
|
230 | 225 |
|
231 | 226 | if (beforeValidationResult === false) {
|
|
0 commit comments