@@ -27,19 +27,11 @@ export function isVueComponent (component: any) {
2727 return true
2828 }
2929
30- if ( component === null ) {
30+ if ( component === null || typeof component !== 'object' ) {
3131 return false
3232 }
3333
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 ) {
4335 return true
4436 }
4537
@@ -53,51 +45,18 @@ export function componentNeedsCompiling (component: Component) {
5345 ! component . functional
5446}
5547
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-
7248export function isRefSelector ( refOptionsObject : any ) {
73- if ( typeof refOptionsObject !== 'object' ) {
49+ if ( typeof refOptionsObject !== 'object' || ! Object . keys ( refOptionsObject || { } ) . length ) {
7450 return false
7551 }
7652
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' )
9356}
9457
9558export 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 ) {
10160 return false
10261 }
10362
0 commit comments