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

Side by Side Diff: packages/html/lib/src/utils.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « packages/html/lib/src/treebuilder.dart ('k') | packages/html/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /// Misc things that were useful when porting the code from Python. 1 /// Misc things that were useful when porting the code from Python.
2 library utils; 2 library utils;
3 3
4 import 'constants.dart'; 4 import 'constants.dart';
5 5
6 typedef bool Predicate(); 6 typedef bool Predicate();
7 7
8 class Pair<F, S> { 8 class Pair<F, S> {
9 final F first; 9 final F first;
10 final S second; 10 final S second;
(...skipping 25 matching lines...) Expand all
36 bool startsWithAny(String str, List<String> prefixes) { 36 bool startsWithAny(String str, List<String> prefixes) {
37 for (var prefix in prefixes) { 37 for (var prefix in prefixes) {
38 if (str.startsWith(prefix)) { 38 if (str.startsWith(prefix)) {
39 return true; 39 return true;
40 } 40 }
41 } 41 }
42 return false; 42 return false;
43 } 43 }
44 44
45 // Like the python [:] operator. 45 // Like the python [:] operator.
46 List slice(List list, int start, [int end]) { 46 List/*<T>*/ slice/*<T>*/(List/*<T>*/ list, int start, [int end]) {
47 if (end == null) end = list.length; 47 if (end == null) end = list.length;
48 if (end < 0) end += list.length; 48 if (end < 0) end += list.length;
49 49
50 // Ensure the indexes are in bounds. 50 // Ensure the indexes are in bounds.
51 if (end < start) end = start; 51 if (end < start) end = start;
52 if (end > list.length) end = list.length; 52 if (end > list.length) end = list.length;
53 return list.sublist(start, end); 53 return list.sublist(start, end);
54 } 54 }
55 55
56 bool allWhitespace(String str) { 56 bool allWhitespace(String str) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 last = match + 1; 115 last = match + 1;
116 } 116 }
117 117
118 result.write(format.substring(last, format.length)); 118 result.write(format.substring(last, format.length));
119 format = result.toString(); 119 format = result.toString();
120 }); 120 });
121 121
122 return format; 122 return format;
123 } 123 }
OLDNEW
« no previous file with comments | « packages/html/lib/src/treebuilder.dart ('k') | packages/html/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698