perf(core): replace Array.forEach loops

This commit is contained in:
braks
2024-02-05 07:51:12 +01:00
committed by Braks
parent 66d7198a2f
commit c4b4a04aa0
9 changed files with 57 additions and 42 deletions
+5 -4
View File
@@ -145,13 +145,14 @@ function defaultState(): State {
export function useState(opts?: FlowOptions): State {
const state = defaultState()
if (opts) {
Object.keys(opts).forEach((o) => {
const option = opts[o as keyof typeof opts]
for (const key of Object.keys(opts)) {
const option = opts[key as keyof typeof opts]
if (isDef(option)) {
;(state as any)[o] = option
;(state as any)[key] = option
}
})
}
}
return state