Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Unified Diff: sdk/lib/_internal/pub/lib/src/utils.dart

Issue 365993007: Support "pub downgrade". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/source/hosted.dart ('k') | sdk/lib/_internal/pub/lib/src/version.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)) {
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/source/hosted.dart ('k') | sdk/lib/_internal/pub/lib/src/version.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698