Skip to content

Commit

Permalink
Fix exception on older browsers
Browse files Browse the repository at this point in the history
Closes GH-246.

Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
Reviewed-by: Remco Haszing <remcohaszing@gmail.com>
Reviewed-by: Titus Wormer <tituswormer@gmail.com>
  • Loading branch information
justinbhopper committed Jun 19, 2024
1 parent 69202f9 commit 1e0863a
Showing 1 changed file with 11 additions and 6 deletions.
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

0 comments on commit 1e0863a

Please sign in to comment.