File tree 2 files changed +9
-4
lines changed 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 1
1
/* @flow */
2
2
3
+ import { isRegExp } from 'shared/util'
3
4
import { getFirstComponentChild } from 'core/vdom/helpers/index'
4
5
5
6
type VNodeCache = { [ key : string ] : ?VNode } ;
@@ -13,7 +14,7 @@ function getComponentName (opts: ?VNodeComponentOptions): ?string {
13
14
function matches (pattern: string | RegExp, name: string): boolean {
14
15
if ( typeof pattern === 'string' ) {
15
16
return pattern . split ( ',' ) . indexOf ( name ) > - 1
16
- } else if (pattern instanceof RegExp ) {
17
+ } else if (isRegExp( pattern) ) {
17
18
return pattern . test ( name )
18
19
}
19
20
/* istanbul ignore next */
Original file line number Diff line number Diff line change @@ -30,14 +30,18 @@ export function isObject (obj: mixed): boolean {
30
30
return obj !== null && typeof obj === 'object'
31
31
}
32
32
33
+ const toString = Object . prototype . toString
34
+
33
35
/**
34
36
* Strict object type check. Only returns true
35
37
* for plain JavaScript objects.
36
38
*/
37
- const toString = Object . prototype . toString
38
- const OBJECT_STRING = '[object Object]'
39
39
export function isPlainObject ( obj : any ) : boolean {
40
- return toString . call ( obj ) === OBJECT_STRING
40
+ return toString . call ( obj ) === '[object Object]'
41
+ }
42
+
43
+ export function isRegExp ( v : any ) : boolean {
44
+ return toString . call ( v ) === '[object RegExp]'
41
45
}
42
46
43
47
/**
You can’t perform that action at this time.
0 commit comments