File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 11/* @flow */
22
3+ import { isRegExp } from 'shared/util'
34import { getFirstComponentChild } from 'core/vdom/helpers/index'
45
56type VNodeCache = { [ key : string ] : ?VNode } ;
@@ -13,7 +14,7 @@ function getComponentName (opts: ?VNodeComponentOptions): ?string {
1314function matches (pattern: string | RegExp, name: string): boolean {
1415 if ( typeof pattern === 'string' ) {
1516 return pattern . split ( ',' ) . indexOf ( name ) > - 1
16- } else if (pattern instanceof RegExp ) {
17+ } else if (isRegExp( pattern) ) {
1718 return pattern . test ( name )
1819 }
1920 /* istanbul ignore next */
Original file line number Diff line number Diff line change @@ -30,14 +30,18 @@ export function isObject (obj: mixed): boolean {
3030 return obj !== null && typeof obj === 'object'
3131}
3232
33+ const toString = Object . prototype . toString
34+
3335/**
3436 * Strict object type check. Only returns true
3537 * for plain JavaScript objects.
3638 */
37- const toString = Object . prototype . toString
38- const OBJECT_STRING = '[object Object]'
3939export 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]'
4145}
4246
4347/**
You can’t perform that action at this time.
0 commit comments