From 1e0863a1e7fe2a94f4287a4c7c1211851e0eef2d Mon Sep 17 00:00:00 2001 From: Justin Hopper <29075873+justinbhopper@users.noreply.github.com> Date: Wed, 19 Jun 2024 05:46:24 -0500 Subject: [PATCH] Fix exception on older browsers Closes GH-246. Reviewed-by: Christian Murphy Reviewed-by: Remco Haszing Reviewed-by: Titus Wormer --- lib/callable-instance.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/callable-instance.js b/lib/callable-instance.js index 3e46cabf..5f20c5e5 100644 --- a/lib/callable-instance.js +++ b/lib/callable-instance.js @@ -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 }