You can handle complex branching using standard JavaScript. Since every pipeline is just a function returning data, you can use if/else or map to return different sub-pipelines and commands from within your logic functions. Here's an example:
const processUsersFlow = () =>
effectPipe(
fetchAllUsers,
(users) => {
const tasks = users.map(user => {
if (user.isAdmin) return syncAdminPermissions(user); // Sub-pipeline
if (user.isGuest) return cleanupGuestAccount(user); // Sub-pipeline
return notifyUser(user); // Simple Command
});
return Parallel(tasks);
}
)();