Index: sdk/lib/_internal/pub/lib/src/utils.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/utils.dart b/sdk/lib/_internal/pub/lib/src/utils.dart |
index 68c0c74188ba3c9add56553c9b6146d2dcf1dad0..fb2fe64c3c44cf2fd64a3d9420b11c4382f14216 100644 |
--- a/sdk/lib/_internal/pub/lib/src/utils.dart |
+++ b/sdk/lib/_internal/pub/lib/src/utils.dart |
@@ -368,6 +368,15 @@ maxAll(Iterable iter, [int compare(element1, element2)]) { |
compare(element, max) > 0 ? element : max); |
} |
+/// Returns the minimum value in [iter] by [compare]. |
+/// |
+/// [compare] defaults to [Comparable.compare]. |
+minAll(Iterable iter, [int compare(element1, element2)]) { |
+ if (compare == null) compare = Comparable.compare; |
+ return iter.reduce((max, element) => |
+ compare(element, max) < 0 ? element : max); |
+} |
+ |
/// Replace each instance of [matcher] in [source] with the return value of |
/// [fn]. |
String replace(String source, Pattern matcher, String fn(Match)) { |