Skip to content

Commit 49cca84

Browse files
committed
⚡ chore: get-field support array call
1 parent 9b84ae7 commit 49cca84

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/core/getField/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// return preset
1010
// }
1111

12-
export const getField = <T>(target: any, path: string, preset?: T): T => {
13-
const keys = path.split('.')
12+
export function getField<T>(target: any, path: string | string[], preset?: T): T {
13+
const keys = Array.isArray(path) ? path : path.split('.')
1414
let value: any = target
1515

1616
for (const key of keys) {

0 commit comments

Comments
 (0)