Created
April 10, 2023 19:14
-
-
Save blakek/778980c6c8d139bf38c1e646945ab98a to your computer and use it in GitHub Desktop.
Run basic external code from a Zapier code step
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
async function importURL(url) { | |
const vm = require("vm"); | |
const res = await fetch(url).then((r) => r.text()); | |
return vm.runInThisContext(res, { filename: url }); | |
} | |
// Example usage: | |
// | |
// await importURL( | |
// "https://gist.githubusercontent.com/blakek/660a8881ae56641d8804971b848df17e/raw/0fb0ec0646d5c8dc353dd9dadc9f5d8ccb7821b2/queryStringParse.js" | |
// ); | |
// | |
// return queryStringParse("q=this%20is%20a%20test"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment