perf: use makeMap for reserved prop check

This commit is contained in:
Evan You 2019-10-26 11:24:37 -04:00
parent 824fb795af
commit 6c7787db7b

View File

@ -1,6 +1,8 @@
import { makeMap } from './makeMap'
export { makeMap }
export * from './patchFlags' export * from './patchFlags'
export { isGloballyWhitelisted } from './globalsWhitelist' export { isGloballyWhitelisted } from './globalsWhitelist'
export { makeMap } from './makeMap'
export const EMPTY_OBJ: { readonly [key: string]: any } = __DEV__ export const EMPTY_OBJ: { readonly [key: string]: any } = __DEV__
? Object.freeze({}) ? Object.freeze({})
@ -55,8 +57,12 @@ export function toRawType(value: unknown): string {
export const isPlainObject = (val: unknown): val is object => export const isPlainObject = (val: unknown): val is object =>
toTypeString(val) === '[object Object]' toTypeString(val) === '[object Object]'
export const isReservedProp = (key: string): boolean => export const isReservedProp = /*#__PURE__*/ makeMap(
key === 'key' || key === 'ref' || key.startsWith(`onVnode`) 'key,ref,' +
'onVnodeBeforeMount,onVnodeMounted,' +
'onVnodeBeforeUpdate,onVnodeUpdated,' +
'onVnodeBeforeUnmount,onVnodeUnmounted'
)
const camelizeRE = /-(\w)/g const camelizeRE = /-(\w)/g
export const camelize = (str: string): string => { export const camelize = (str: string): string => {