Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception on older browsers #246

Merged
merged 9 commits into from
Jun 19, 2024
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
Loading