JavaScript Code to Flowchart avatar
JavaScript Code to Flowchart
Try for free

No credit card required

View all Actors
JavaScript Code to Flowchart

JavaScript Code to Flowchart

drobnikj/js-code-2-flowchart
Try for free

No credit card required

Use this to convert JavaScript code to a flowchart. The actor uses https://www.npmjs.com/package/js2flowchart npm package to convert the code to a flowchart. The output is an SVG file.

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn more

1# Set API token
2API_TOKEN=<YOUR_API_TOKEN>
3
4# Prepare Actor input
5cat > input.json <<'EOF'
6{
7  "code": "// The function accepts a single argument: the \"context\" object.\n// For a complete list of its properties and functions,\n// see https://apify.com/apify/web-scraper#page-function \nasync function pageFunction(context) {\n    // This statement works as a breakpoint when you're trying to debug your code. Works only with Run mode: DEVELOPMENT!\n    // debugger; \n\n    // jQuery is handy for finding DOM elements and extracting data from them.\n    // To use it, make sure to enable the \"Inject jQuery\" option.\n    const $ = context.jQuery;\n    const pageTitle = $('title').first().text();\n\n    // Print some information to actor log\n    context.log.info(`URL: ${context.request.url}, TITLE: ${pageTitle}`);\n\n    // Manually add a new page to the queue for scraping.\n    context.enqueueRequest({ url: 'http://www.example.com' });\n\n    // Return an object with the data extracted from the page.\n    // It will be stored to the resulting dataset.\n    return {\n        url: context.request.url,\n        pageTitle\n    };\n}"
8}
9EOF
10
11# Run the Actor using an HTTP API
12# See the full API reference at https://docs.apify.com/api/v2
13curl "https://api.apify.com/v2/acts/drobnikj~js-code-2-flowchart/runs?token=$API_TOKEN" \
14  -X POST \
15  -d @input.json \
16  -H 'Content-Type: application/json'
Developer
Maintained by Community
Actor metrics
  • 4 monthly users
  • 4 stars
  • 84.4% runs succeeded
  • 72 days response time
  • Created in Nov 2017
  • Modified 10 months ago
Categories