Skip to content

Javascript Step Functions

Functions (the current host language) that enable functionality (so far) not expressable with apath, and the invocation of other services. They have to conform to the following form:

function <func-id>(ctx_node, arg1, ... , argN) {
    // ... process context node 'ctx_node' and arguments
    // ... possibly check an argument with 'apart.isApathIterable(argI)'
    // ... create return value r that is an 
    // *apath-js-iterable*, *undefined* or other javascript value 
    return r
}

where the first parameter ctx_node is the context node passed from path evaluation. An argument argI is either a node or an apath-js-iterable that represents sequences.

The return value r must be either a node, an apath-js-iterable, or undefined.

\(x\) is apath-js-iterable if

  • \(x\) is neither null, undefined, a string, or an array, and
  • \(x\) is javascript-iterable (see Iteration protocols)

To check wether an argument argI is apath-js-iterable, the runtime function isApathIterable can be used.

The return value undefined indicates that no solution exists. In this case, at the path evaluation component, no further steps are performed, and the path has no solution . It is semantically equivalent to returning an empty sequence.