From fbbd6f172220ce9904d9fd9d23586d0466a495c8 Mon Sep 17 00:00:00 2001 From: Kuitos Date: Tue, 8 Dec 2020 14:34:45 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20use=20Function.prototype.bind=20?= =?UTF-8?q?instead=20to=20avoid=20conflict=20while=20value=20has=20own=20b?= =?UTF-8?q?ind=20function=20(#1133)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sandbox/common.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sandbox/common.ts b/src/sandbox/common.ts index 1388923..65475d5 100644 --- a/src/sandbox/common.ts +++ b/src/sandbox/common.ts @@ -26,7 +26,7 @@ export function getTargetValue(target: any, value: any): any { return cachedBoundValue; } - const boundValue = value.bind(target); + const boundValue = Function.prototype.bind.call(value, target); // some callable function has custom fields, we need to copy the enumerable props to boundValue. such as moment function. // use for..in rather than Object.keys.forEach for performance reason // eslint-disable-next-line guard-for-in,no-restricted-syntax