vue3-core/packages/runtime-core/src/internalObject.ts

14 lines
523 B
TypeScript

/**
* Used during vnode props/slots normalization to check if the vnode props/slots
* are the internal attrs / slots object of a component via
* `Object.getPrototypeOf`. This is more performant than defining a
* non-enumerable property. (one of the optimizations done for ssr-benchmark)
*/
const internalObjectProto = {}
export const createInternalObject = (): any =>
Object.create(internalObjectProto)
export const isInternalObject = (obj: object): boolean =>
Object.getPrototypeOf(obj) === internalObjectProto