Skip to content

Commit 8c57402

Browse files
committed
fix: 🔒 replace by lodash
1 parent 1e22769 commit 8c57402

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/Validator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { SimpleObject } from '../types'
2-
import { castArray, cloneDeep, get, has, omit } from 'lodash'
2+
import { castArray, cloneDeep, get, has, omit, replace } from 'lodash'
33
import { is, toCamelCase, toSnakeCase } from '../util'
44

55
class Validator {
@@ -99,7 +99,7 @@ class Validator {
9999
fields(field: string | string[]) {
100100
const processField = (f: string) => {
101101
if (f.includes('*')) {
102-
const regex = new RegExp(`^${f.replace('*', '.*')}$`, 'i')
102+
const regex = new RegExp(`^${replace(f, '*', '.*')}$`, 'i')
103103
for (const key in this.errors) {
104104
if (regex.test(key)) fields.push(toCamelCase(key), toSnakeCase(key))
105105
}

0 commit comments

Comments
 (0)