2024-04-16 22:47:24 +08:00
|
|
|
/**
|
|
|
|
* 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)
|
|
|
|
*/
|
2024-04-24 18:28:49 +08:00
|
|
|
const internalObjectProto = {}
|
2024-04-16 22:47:24 +08:00
|
|
|
|
2024-08-08 23:05:21 +08:00
|
|
|
export const createInternalObject = (): any =>
|
|
|
|
Object.create(internalObjectProto)
|
2024-04-16 22:47:24 +08:00
|
|
|
|
2024-08-08 23:05:21 +08:00
|
|
|
export const isInternalObject = (obj: object): boolean =>
|
2024-04-16 22:47:24 +08:00
|
|
|
Object.getPrototypeOf(obj) === internalObjectProto
|