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

Try for free

No credit card required

Use this to convert JavaScript code to a flowchart. The actor uses 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

1from apify_client import ApifyClient
3# Initialize the ApifyClient with your Apify API token
4client = ApifyClient("<YOUR_API_TOKEN>")
6# Prepare the Actor input
7run_input = { "code": """// The function accepts a single argument: the \"context\" object.
8// For a complete list of its properties and functions,
9// see 
10async function pageFunction(context) {
11    // This statement works as a breakpoint when you're trying to debug your code. Works only with Run mode: DEVELOPMENT!
12    // debugger; 
14    // jQuery is handy for finding DOM elements and extracting data from them.
15    // To use it, make sure to enable the \"Inject jQuery\" option.
16    const $ = context.jQuery;
17    const pageTitle = $('title').first().text();
19    // Print some information to actor log
20`URL: ${context.request.url}, TITLE: ${pageTitle}`);
22    // Manually add a new page to the queue for scraping.
23    context.enqueueRequest({ url: '' });
25    // Return an object with the data extracted from the page.
26    // It will be stored to the resulting dataset.
27    return {
28        url: context.request.url,
29        pageTitle
30    };
31}""" }
33# Run the Actor and wait for it to finish
34run ="drobnikj/js-code-2-flowchart").call(run_input=run_input)
36# Fetch and print Actor results from the run's dataset (if there are any)
37print("💾 Check your data here:" + run["defaultDatasetId"])
38for item in client.dataset(run["defaultDatasetId"]).iterate_items():
39    print(item)
41# 📚 Want to learn more 📖? Go to →
Maintained by Community
Actor metrics
  • 19 monthly users
  • 0 stars
  • 92.7% runs succeeded
  • 15 days response time
  • Created in Nov 2017
  • Modified 8 months ago