apify_animation_01_02
Actor picture

JavaScript Code to Flowchart

drobnikj/js-code-2-flowchart

Use this act to convert Javascript code to flowchart. Act uses https://www.npmjs.com/package/js2flowchart npm package to convert code to flowchart. Types of input: 1. Code as string with contentType 'application/javascript' 2. JSON with attribute crawlerId with contentType 'application/json' (Converts pageFunction from crawler to flowchart) { "crawlerId": "s3jg9zhn0sdx" } 2. JSON with attribute inputCode Output is a SVG file.

To run the actor, you'll need an Apify account. Simply create a new task for the actor by clicking the button below, modify the actor input configuration, click Run and get your results.

API

To run the actor from your code, send a HTTP POST request to the following API endpoint:

https://api.apify.com/v2/acts/drobnikj~js-code-2-flowchart/runs?token=<YOUR_API_TOKEN>

The POST payload including its Content-Type header is passed as INPUT to the actor (usually application/json). The actor is started with the default options; you can override them using various URL query parameters.

Example
curl https://api.apify.com/v2/acts/drobnikj~js-code-2-flowchart/runs?token=<YOUR_API_TOKEN> \
-d 'function indexSearch(list, element) {
    let currentIndex,
        currentElement,
        minIndex = 0,
        maxIndex = list.length - 1;
 
    while (minIndex <= maxIndex) {
        currentIndex = Math.floor(maxIndex + maxIndex) / 2;
        currentElement = list[currentIndex];
 
        if (currentElement === element) {
            return currentIndex;
        }
 
        if (currentElement < element) {
            minIndex = currentIndex + 1;
        }
 
        if (currentElement > element) {
            maxIndex = currentIndex - 1;
        }
    }
 
    return -1;
}' \
-H 'Content-Type: application/json' \
-X POST

To use the API, you'll need to replace <YOUR_API_TOKEN> with the API token of your Apify account (view here).

For more information, view the list of actor's API endpoints or the full API reference.

  • Modified
  • Last run
  • Used42 times