Hi all,

I've searched the forums, yet can't find anything that describes an answer 
to what I am looking for.

In a nutshell, I would like to control flow of my application be defined by 
an external flow input (file) in which the individual steps (functions) to 
call, their order and conditions are described.

Example code with hardcoded control flow:

// Code

function A(input){
return input * 2;
}

function B(input){
return input + 2;
}

function C(input){
return input / 2;
}

functionZ(input){
if(input==3) lowResult();
else highResult();;
}

function lowResult(){
console.log('Result smaller than 4');
}

function highResult(){
console.log('Result equal or larger than 4')
}

// flow 1
Z(C(B(A(2)))); // (((2 * 2) + 2) / 2) = 3 returns 'Result smaller than 4'
// flow 2
Z(B(C(A(2)))); // (((2 * 2) / 2) + 2) = 4 returns 'Result equal or larger 4'


Now what I am looking for is a library or approach that allows me to define 
flow 1 and flow 2 in a file and then have the code execute according to the 
defined flow. Best would be format that allows for conditions, etc as well.

<!-- FLOW 1 -->
<STEP function="A" />
<STEP function="A" />

<STEP function="A" />

<IF condition="==3">
   <STEP function="lowResult" />>
<ELSE>
   <STEP function="highResult" />
</IF>



That way different control flows could be easily composed by connecting a 
number of components.

Thanks for reading,
Phil


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/cdc913be-c56a-4605-95ec-bbf4122768ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to