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

Side by Side Diff: pkg/stub_core_library/lib/src/utils.dart

Issue 1134583005: Remove the core library stubbing infrastructure. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library stub_core_libraries.utils;
6
7 /// Returns a sentence fragment listing the elements of [iter].
8 ///
9 /// This converts each element of [iter] to a string and separates them with
10 /// commas and/or "and" where appropriate.
11 String toSentence(Iterable iter) {
12 if (iter.length == 1) return iter.first.toString();
13 return iter.take(iter.length - 1).join(", ") + " and ${iter.last}";
14 }
15
16 /// Returns [name] if [number] is 1, or the plural of [name] otherwise.
17 ///
18 /// By default, this just adds "s" to the end of [name] to get the plural. If
19 /// [plural] is passed, that's used instead.
20 String pluralize(String name, int number, {String plural}) {
21 if (number == 1) return name;
22 if (plural != null) return plural;
23 return '${name}s';
24 }
OLDNEW
« no previous file with comments | « pkg/stub_core_library/bin/stub_core_library.dart ('k') | pkg/stub_core_library/lib/stub_core_library.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698