@@ -27,19 +27,11 @@ export function isVueComponent (component: any) {
27
27
return true
28
28
}
29
29
30
- if ( component === null ) {
30
+ if ( component === null || typeof component !== 'object' ) {
31
31
return false
32
32
}
33
33
34
- if ( typeof component !== 'object' ) {
35
- return false
36
- }
37
-
38
- if ( component . extends ) {
39
- return true
40
- }
41
-
42
- if ( component . _Ctor ) {
34
+ if ( component . extends || component . _Ctor ) {
43
35
return true
44
36
}
45
37
@@ -53,51 +45,18 @@ export function componentNeedsCompiling (component: Component) {
53
45
! component . functional
54
46
}
55
47
56
- export function isValidSelector ( selector : any ) {
57
- if ( isDomSelector ( selector ) ) {
58
- return true
59
- }
60
-
61
- if ( isVueComponent ( selector ) ) {
62
- return true
63
- }
64
-
65
- if ( isNameSelector ( selector ) ) {
66
- return true
67
- }
68
-
69
- return isRefSelector ( selector )
70
- }
71
-
72
48
export function isRefSelector ( refOptionsObject : any ) {
73
- if ( typeof refOptionsObject !== 'object' ) {
49
+ if ( typeof refOptionsObject !== 'object' || ! Object . keys ( refOptionsObject || { } ) . length ) {
74
50
return false
75
51
}
76
52
77
- if ( refOptionsObject === null ) {
78
- return false
79
- }
80
-
81
- const validFindKeys = [ 'ref' ]
82
- const keys = Object . keys ( refOptionsObject )
83
- if ( ! keys . length ) {
84
- return false
85
- }
86
-
87
- const isValid = Object . keys ( refOptionsObject ) . every ( ( key ) => {
88
- return validFindKeys . includes ( key ) &&
89
- typeof refOptionsObject [ key ] === 'string'
90
- } )
91
-
92
- return isValid
53
+ return Object
54
+ . keys ( refOptionsObject )
55
+ . every ( key => [ 'ref' ] . includes ( key ) && typeof refOptionsObject [ key ] === 'string' )
93
56
}
94
57
95
58
export function isNameSelector ( nameOptionsObject : any ) {
96
- if ( typeof nameOptionsObject !== 'object' ) {
97
- return false
98
- }
99
-
100
- if ( nameOptionsObject === null ) {
59
+ if ( typeof nameOptionsObject !== 'object' || nameOptionsObject === null ) {
101
60
return false
102
61
}
103
62
0 commit comments