refactor: use faster key check

This commit is contained in:
Evan You
2018-10-17 12:20:54 -04:00
parent 30404ec546
commit 1c42c96d1a
5 changed files with 14 additions and 18 deletions

View File

@@ -2,9 +2,11 @@ export const EMPTY_OBJ: { readonly [key: string]: any } = Object.freeze({})
export const NOOP = () => {}
export const onRE = /^on/
export const reservedPropRE = /^(?:key|ref|slots)$|^vnode/
export const isOn = (key: string) => key[0] === 'o' && key[1] === 'n'
export const isReservedKey = (key: string) => key[0] === '_' || key[0] === '$'
export const isArray = Array.isArray
export const isFunction = (val: any): val is Function =>
typeof val === 'function'