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

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

Issue 22284003: pkg: analysis aided cleanup (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nits Created 7 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 | Annotate | Revision Log
« no previous file with comments | « pkg/http/lib/src/request.dart ('k') | pkg/http/test/client_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library utils; 5 library utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:typed_data'; 9 import 'dart:typed_data';
10 import 'dart:utf'; 10 import 'dart:utf';
11 11
12 import "package:crypto/crypto.dart";
13
14 import 'byte_stream.dart'; 12 import 'byte_stream.dart';
15 13
16 /// Converts a URL query string (or `application/x-www-form-urlencoded` body) 14 /// Converts a URL query string (or `application/x-www-form-urlencoded` body)
17 /// into a [Map] from parameter names to values. 15 /// into a [Map] from parameter names to values.
18 /// 16 ///
19 /// queryToMap("foo=bar&baz=bang&qux"); 17 /// queryToMap("foo=bar&baz=bang&qux");
20 /// //=> {"foo": "bar", "baz": "bang", "qux": ""} 18 /// //=> {"foo": "bar", "baz": "bang", "qux": ""}
21 Map<String, String> queryToMap(String queryList) { 19 Map<String, String> queryToMap(String queryList) {
22 var map = {}; 20 var map = {};
23 for (var pair in queryList.split("&")) { 21 for (var pair in queryList.split("&")) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 /// The return values of all [Future]s are discarded. Any errors will cause the 225 /// The return values of all [Future]s are discarded. Any errors will cause the
228 /// iteration to stop and will be piped through the return value. 226 /// iteration to stop and will be piped through the return value.
229 Future forEachFuture(Iterable input, Future fn(element)) { 227 Future forEachFuture(Iterable input, Future fn(element)) {
230 var iterator = input.iterator; 228 var iterator = input.iterator;
231 Future nextElement(_) { 229 Future nextElement(_) {
232 if (!iterator.moveNext()) return new Future.value(); 230 if (!iterator.moveNext()) return new Future.value();
233 return fn(iterator.current).then(nextElement); 231 return fn(iterator.current).then(nextElement);
234 } 232 }
235 return nextElement(null); 233 return nextElement(null);
236 } 234 }
OLDNEW
« no previous file with comments | « pkg/http/lib/src/request.dart ('k') | pkg/http/test/client_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698