UNPKG

workflow-4-node

Version:

Workflow 4 Node is a .NET Workflow Foundation like framework for Node.js. The goal is to reach feature equivalence and beyond.

38 lines (29 loc) 789 B
"use strict"; let Activity = require("./activity"); let util = require("util"); function Falsy() { Activity.call(this); this.value = false; this.is = true; this.isNot = false; } util.inherits(Falsy, Activity); Falsy.prototype.run = function(callContext, args) { callContext.schedule(this.value, "_valueGot"); }; Falsy.prototype._valueGot = function(callContext, reason, result) { if (reason !== Activity.states.complete) { callContext.end(reason, result); return; } if (result) { callContext.schedule(this.isNot, "_done"); } else { callContext.schedule(this.is, "_done"); } }; Falsy.prototype._done = function(callContext, reason, result) { callContext.end(reason, result); }; module.exports = Falsy;