🐛 use Function.prototype.bind instead to avoid conflict while value has own bind function (#1133)

This commit is contained in:
Kuitos 2020-12-08 14:34:45 +08:00 committed by GitHub
parent 9fd4b847cc
commit fbbd6f1722

View File

@ -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