static Cluster byLabel()

in lib/github_datatypes.dart [1722:1744]


  static Cluster byLabel(List<dynamic> issuesOrPullRequests) {
    var result = SplayTreeMap<String, dynamic>();
    result[_unlabeledKey] = [];

    for (var item in issuesOrPullRequests) {
      if (!(item is Issue) && !(item is PullRequest)) {
        throw ('invalid type!');
      }
      if (item.labels != null) {
        for (var label in item.labels.labels) {
          var name = label.label;
          if (!result.containsKey(name)) {
            result[name] = [];
          }
          result[name].add(item);
        }
      } else {
        result[_unlabeledKey].add(item);
      }
    }

    return Cluster._internal(ClusterType.byLabel, result);
  }