Skip to content

API syntax styling preference #59

@reynaldichernando

Description

@reynaldichernando

The syntax format that we have right now are as follows:

Image

so we are doing this thing of, naming function argument, like this testMode

puter.ai.txt2vid(prompt, testMode = false)

the thing is, javascript don't support this type of assign param by name, it's a python thing
(https://stackoverflow.com/questions/11495031/python-passing-parameters-by-name)

but thankfully JS is super forgiving so nothing is broken in this code, what happens instead in the code is

  1. it declares a variable called testMode
  2. it assigns the value false to this testMode variable
  3. this testMode variable/reference is then passed to the function

it all happens in one line.

a side effect of this is, it creates a variable named testMode that can be accessed outside the scope of the function

i first noticed this when my javascript linter auto lint this syntax to have parentheses

Image

^ this version is also working, because it's doing the same thing as previous one, just with parentheses to create grouping

so the main point of this issue is, which syntax styling do we want to show in our docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions