Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
worst api ever
const http = new Proxy({}, {
get(t, k) {
const url = `https://crossorigin.me/http://${k.replace(/_/g, '.')}`;
return new Proxy({}, {
get(t, k) {
fetch(url)
.then(res => res.text())
.then(res => {
(new Function(`return (${k})(\`${res.replace(/`/g, '\\`')}\`)`))()
});
}
});
}
});
// do a fetch request
http.www_google_com[(src) => {
console.log(src);
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment