![JavaScript Code to Flowchart avatar](https://images.apifyusercontent.com/-V31VXk1kLlHqZgkk-WOp3bcKolxF2qXfOZhLAwLbFM/rs:fill:250:250/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9TQm5vNUNoa2puZ3BXTGdaaS9UOEhxdVQ2d3NOMldSNUoybi1mbG93Y2hhcnQtMDEucG5n.webp)
JavaScript Code to Flowchart
Try for free
No credit card required
View all Actors![JavaScript Code to Flowchart](https://images.apifyusercontent.com/-V31VXk1kLlHqZgkk-WOp3bcKolxF2qXfOZhLAwLbFM/rs:fill:250:250/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9TQm5vNUNoa2puZ3BXTGdaaS9UOEhxdVQ2d3NOMldSNUoybi1mbG93Y2hhcnQtMDEucG5n.webp)
![JavaScript Code to Flowchart](https://images.apifyusercontent.com/-V31VXk1kLlHqZgkk-WOp3bcKolxF2qXfOZhLAwLbFM/rs:fill:250:250/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9TQm5vNUNoa2puZ3BXTGdaaS9UOEhxdVQ2d3NOMldSNUoybi1mbG93Y2hhcnQtMDEucG5n.webp)
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
1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4client = ApifyClient("<YOUR_API_TOKEN>")
5
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 https://apify.com/apify/web-scraper#page-function
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;
13
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();
18
19 // Print some information to actor log
20 context.log.info(`URL: ${context.request.url}, TITLE: ${pageTitle}`);
21
22 // Manually add a new page to the queue for scraping.
23 context.enqueueRequest({ url: 'http://www.example.com' });
24
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}""" }
32
33# Run the Actor and wait for it to finish
34run = client.actor("drobnikj/js-code-2-flowchart").call(run_input=run_input)
35
36# Fetch and print Actor results from the run's dataset (if there are any)
37print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
38for item in client.dataset(run["defaultDatasetId"]).iterate_items():
39 print(item)
40
41# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
Developer
Maintained by Community
Actor metrics
- 10 monthly users
- 4 stars
- 88.1% runs succeeded
- Created in Nov 2017
- Modified 12 months ago
Categories