Skip to content

Procedures

Jiří Cihelka edited this page Dec 30, 2023 · 2 revisions

Procedures are pure functions. While the procedure is a function, it is defined as a class, so that it can follow the standard practices of the library.

What a procedure consists of

A procedure consists of the following:

  • Goal
    The goal of the procedure. This describes what the procedure does and why.
  • Inputs
    A set of inputs for the procedure in the form of a JavaScript object.
  • Outputs
    A set of outputs for the procedure in the form of a JavaScript object.
  • Procedure
    The procedure itself. This describes how the procedure works.

Difference between a procedure and a function

A procedure is a function that takes one JavaScript object as an input and returns one JavaScript object as an output. This standardization allows for predictable usage of procedures.

How are procedures defined

A procedure is defined as a class that extends the Procedure class. Only one instance of a procedure should exist. This instance should be exported from the procedure file.

Typing of procedures

The procedure class is generic. It takes two type parameters - the input and the output type.

Documentation of procedures

Procedures should be documented on the wiki in the docs/wiki/procedures directory. The documentation should follow the same structure as the documentation of the library itself. The documentation should be written in Markdown. If you are looking for the documentation of a procedure, you can find the page on the wiki.

Some procedures are considered to be foundational. These do not have their own wiki page. Instead, they have their explanation written in the JSDoc of the procedure itself.