Chromium Code Reviews

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

Issue 566093003: Create binstubs for executables when activating a package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: sdk/lib/_internal/pub_generated/lib/src/utils.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/utils.dart b/sdk/lib/_internal/pub_generated/lib/src/utils.dart
index dcaf04417d560df5efb84f6c588b3bcf6a077584..30ce6c6c57632793815c2e8fea242c16c9c9c1f8 100644
--- a/sdk/lib/_internal/pub_generated/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/utils.dart
@@ -102,6 +102,12 @@ String padRight(String source, int length) {
}
return result.toString();
}
+String namedSequence(String name, Iterable iter, [String plural]) {
+ if (iter.length == 1) return "$name ${iter.first}";
+ var sequence = iter.take(iter.length - 1).join(", ") + " and ${iter.last}";
+ if (plural == null) plural = "${name}s";
+ return "$plural $sequence";
+}
String toSentence(Iterable iter) {
if (iter.length == 1) return iter.first.toString();
return iter.take(iter.length - 1).join(", ") + " and ${iter.last}";

Powered by Google App Engine