eitherList function
Implementation
String eitherList(List<dynamic> args) {
Map<String, dynamic>? opts;
final argsCopy = List<dynamic>.from(args);
if (argsCopy.isNotEmpty && argsCopy.last is Map<String, dynamic>) {
opts = argsCopy.removeLast() as Map<String, dynamic>;
}
final capture = opts != null && opts['capture'] == true;
final joined =
'(${capture ? "" : "?:"}${argsCopy.map((x) => source(x)).join("|")})';
return joined;
}