doczjs / docz

✍ It has never been so easy to document your things!
https://docz.site
MIT License
23.63k stars 1.46k forks source link

fix(babel-plugin-export-metadata): fix `hasOwnProperty` method call #1581

Closed ambar closed 3 years ago

ambar commented 4 years ago

Fixes #1287 (when using export * as).

Demo:

const obj = Object.create(null)
console.info([
  // true
  Object.isExtensible(obj),
  // false
  obj instanceof Object,
  // TypeError: obj.hasOwnProperty is not a function
  // obj.hasOwnProperty('key'),
  // false
  Object.prototype.hasOwnProperty.call(bar, 'key'),
])

Object.defineProperty(obj, 'key', {value: 1})
// true
console.info(Object.prototype.hasOwnProperty.call(obj, 'key'))
ambar commented 3 years ago

@pedronauck

pedronauck commented 3 years ago

thanks @ambar 🙏🏻