Skip to content

Commit c1c606e

Browse files
committed
refactor: use isObject
1 parent 592361b commit c1c606e

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

packages/runtime-core/src/componentEmits.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
hyphenate,
88
isArray,
99
isFunction,
10+
isObject,
1011
isOn,
1112
toNumber,
1213
UnionToIntersection
@@ -226,7 +227,7 @@ export function normalizeEmitsOptions(
226227
}
227228

228229
if (!raw && !hasExtends) {
229-
if (comp && typeof comp === 'object') {
230+
if (isObject(comp)) {
230231
cache.set(comp, null)
231232
}
232233
return null
@@ -238,7 +239,7 @@ export function normalizeEmitsOptions(
238239
extend(normalized, raw)
239240
}
240241

241-
if (comp && typeof comp === 'object') {
242+
if (isObject(comp)) {
242243
cache.set(comp, normalized)
243244
}
244245
return normalized

packages/runtime-core/src/componentOptions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ export function resolveMergedOptions(
966966
}
967967
mergeOptions(resolved, base, optionMergeStrategies)
968968
}
969-
if (base && typeof base === 'object') {
969+
if (isObject(base)) {
970970
cache.set(base, resolved)
971971
}
972972
return resolved

packages/runtime-core/src/componentProps.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ export function normalizePropsOptions(
494494
}
495495

496496
if (!raw && !hasExtends) {
497-
if (comp && typeof comp === 'object') {
497+
if (isObject(comp)) {
498498
cache.set(comp, EMPTY_ARR as any)
499499
}
500500
return EMPTY_ARR as any
@@ -536,7 +536,7 @@ export function normalizePropsOptions(
536536
}
537537

538538
const res: NormalizedPropsOptions = [normalized, needCastKeys]
539-
if (comp && typeof comp === 'object') {
539+
if (isObject(comp)) {
540540
cache.set(comp, res)
541541
}
542542
return res

0 commit comments

Comments
 (0)