Improved exportFunctionWithName

To reduce the need of double exports.
This commit is contained in:
kkapsner 2020-11-02 13:11:50 +01:00
parent c16068ca85
commit d5417cf807
1 changed files with 2 additions and 1 deletions

View File

@ -95,7 +95,8 @@
};
scope.exportFunctionWithName = function exportFunctionWithName(func, context, name){
const exportedTry = exportFunction(func, context, {allowCrossOriginArguments: true});
const targetObject = scope.getWrapped(context).Object.create(null);
const exportedTry = exportFunction(func, targetObject, {allowCrossOriginArguments: true, defineAs: name});
if (exportedTry.name === name){
return exportedTry;
}