]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
perf: use makeMap for reserved prop check
authorEvan You <yyx990803@gmail.com>
Sat, 26 Oct 2019 15:24:37 +0000 (11:24 -0400)
committerEvan You <yyx990803@gmail.com>
Sat, 26 Oct 2019 15:24:37 +0000 (11:24 -0400)
packages/shared/src/index.ts

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