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

Unified Diff: utils/pub/package.dart

Issue 14071002: Added new version of reduce. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed more uses of max, and a few bugs. Created 7 years, 8 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
Index: utils/pub/package.dart
diff --git a/utils/pub/package.dart b/utils/pub/package.dart
index d3d9819088ce9d30a76baab19871991b658034f0..883b01b1bdef01cade760790d543548bdab19661 100644
--- a/utils/pub/package.dart
+++ b/utils/pub/package.dart
@@ -48,12 +48,12 @@ class Package {
where((entry) => entry.contains(_README_REGEXP));
if (readmes.isEmpty) return;
- return path.join(dir, readmes.min((readme1, readme2) {
+ return path.join(dir, readmes.reduce((readme1, readme2) {
var extensions1 = ".".allMatches(readme1).length;
var extensions2 = ".".allMatches(readme2).length;
var comparison = extensions1.compareTo(extensions2);
- if (comparison != 0) return comparison;
- return readme1.compareTo(readme2);
+ if (comparison == 0) comparison = readme1.compareTo(readme2);
+ return (comparison <= 0) ? readme1 : readme2;
}));
}

Powered by Google App Engine
This is Rietveld 408576698