Specification

A graph is a collection of tasks and pipes that can be stored in JSON format.

Every task refers to a function which output can be piped as an argument to another task.

A graph has the following properties

Task resolution

Builtin functions

dflow provides few builtin functions and injects the following ones

Additional functions

You can pass a second optional argument to dflow.fun() containing a collection of additional functions that will be used in the task resolution.

In order to avoid conflicts with injected functions, the optional collection of additionalFunctions must contain function names validated by the following rules:

Arrow functions and new

If a task string does not match with some of the builtin functions above and neither some addition function provided, but it contains an arrow => the dflow engine will try to eval it. Yes, I know, eval is evil but think about using an arrow function. By adding this feature to the specification, you can create a task like x => x * 2.

I admit I failed to resist the eval temptation, in deed there is also another type of tasks that uses it. If a task starts with the four characters *new *, i.e. new plus a space, it is evaluated. Yes, you can write new Date and it will return a date.

Note that the evaluation is performed on compile time.

Info

This section is a draft

context

Context tells if the graph should run client side or server side. Values can be

If not specified, it is assumed to be universal a.k.a. isomorphic.