flowcode
Version:
Tools for building dataflow graphs
27 lines • 806 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Creates a node based on the specified output port names and input port
* collection generator function.
* @param outFields List of output port names.
* @param createInPorts Creates a set of input ports.
*/
function createNode(outFields, createInPorts) {
const o = {};
const outputs = {};
for (const field of outFields) {
o[field] = new Set();
}
for (const field in o) {
const inPorts = o[field];
outputs[field] = (value, tag) => {
for (const inPort of inPorts) {
inPort(value, tag);
}
};
}
const i = createInPorts(outputs);
return { i, o };
}
exports.createNode = createNode;
//# sourceMappingURL=createNode.js.map
;