Skip to content

Commit

Permalink
refactor: avoid repeat iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Mar 28, 2023
1 parent 243ca65 commit d4f70d5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/runtime-core/src/componentProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,10 @@ function validateProp(
if (type != null && type !== true) {
let isValid = false
const types = isArray(type) ? type : [type]
if (types.includes(null as any)) {
return
}
const expectedTypes = []
// value is valid as long as one of the specified types match
for (let i = 0; i < types.length && !isValid; i++) {
if (types[i] === null) return
const { valid, expectedType } = assertType(value, types[i])
expectedTypes.push(expectedType || '')
isValid = valid
Expand Down

0 comments on commit d4f70d5

Please sign in to comment.