batchCheck function

Stream<CheckedDomain> batchCheck(
  1. Iterable<String> input
)

Implementation

Stream<CheckedDomain> batchCheck(Iterable<String> input) async* {
  final checks = <Future>[];

  for (final domain in input) {
    for (final variant in expand(domain)) {
      final parts = variant.split('.');
      assert(parts.length == 2);

      final name = parts.first;
      final tld = parts.last;

      checks.add(
        check(name, tlds: tld == '*' ? asteriskTLDs : [tld]),
      );
    }
  }

  await for (final checked in Stream.fromFutures(checks)) {
    yield* Stream.fromIterable(checked);
  }
}