-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove Object.assign polyfill from core-js
- Loading branch information
Showing
4 changed files
with
7 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,7 @@ | ||
import React from "react"; | ||
import assign from "core-js/features/object/assign"; | ||
|
||
export const _poly = { assign }; | ||
|
||
const evalCode = (code, scope) => { | ||
const scopeKeys = Object.keys(scope); | ||
const scopeValues = scopeKeys.map((key) => scope[key]); | ||
// eslint-disable-next-line no-new-func | ||
const res = new Function("_poly", "React", ...scopeKeys, code); | ||
return res(_poly, React, ...scopeValues); | ||
return new Function(...scopeKeys, code)(...scopeValues); | ||
}; | ||
|
||
export default evalCode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters