Created
May 3, 2019 21:23
-
-
Save psiie/e6090d79afd386f792269df0a60b2405 to your computer and use it in GitHub Desktop.
Get the original function in javascript. useful if someone has replaced the function or you must guarantee that it is clean.
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
function _Function(path) { | |
let fn = () => {}; | |
const split = path.split('.'); | |
const $iframe = document.createElement('iframe'); | |
$iframe.src = 'about:blank'; | |
document.body.appendChild($iframe); | |
fn = $iframe.contentWindow; | |
for (let i=0; i<split.length; i++) { | |
fn = fn[split[i]]; | |
} | |
$iframe.parentElement.removeChild($iframe); | |
return fn; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment