Skip to content
17 changes: 11 additions & 6 deletions lib/callable-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@ export const CallableInstance =

Object.setPrototypeOf(apply, proto)

const names = Object.getOwnPropertyNames(value)

for (const p of names) {
const descriptor = Object.getOwnPropertyDescriptor(value, p)
if (descriptor) Object.defineProperty(apply, p, descriptor)
}
// Not needed for us in `unified`: we only call this on the `copy`
// function,
// and we don't need to add its fields (`length`, `name`)
// over.
// See also: GH-246.
// const names = Object.getOwnPropertyNames(value)
//
// for (const p of names) {
// const descriptor = Object.getOwnPropertyDescriptor(value, p)
// if (descriptor) Object.defineProperty(apply, p, descriptor)
// }

return apply
}
Expand Down