internalObject.ts 507 B

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