:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
We should really refactor this switch statement. Thought that just occurred to me: something like this:
for (const { nodeType, predicate, saga } of sagaConditions) {
if (node.nodeType !== nodeType) {
continue;
}
if (!(yield* predicate())) {
continue;
}
yield* saga();
break;
}
Then you'd could have a lot of flexibility on how you want to specify sagaConditions - eventually they might span modules or we could factor out commonalities?
Anyway, just a thought. If you're interested, maybe it's worth making an issue from this comment.
We should really refactor this
switch
statement. Thought that just occurred to me: something like this:Then you'd could have a lot of flexibility on how you want to specify
sagaConditions
- eventually they might span modules or we could factor out commonalities?Anyway, just a thought. If you're interested, maybe it's worth making an issue from this comment.
_Originally posted by @gnidan in https://github.com/trufflesuite/truffle/pull/4015#discussion_r635672033_