chore(format): update to latest formatter

Closes #7958
This commit is contained in:
Alex Eagle
2016-04-07 17:17:50 -07:00
committed by Alex Eagle
parent 83b8f59297
commit 03627aa84d
527 changed files with 13975 additions and 19252 deletions

View File

@ -45,8 +45,8 @@ export class JSONPConnection_ extends JSONPConnection {
private _responseData: any;
private _finished: boolean = false;
constructor(req: Request, private _dom: BrowserJsonp,
private baseResponseOptions?: ResponseOptions) {
constructor(
req: Request, private _dom: BrowserJsonp, private baseResponseOptions?: ResponseOptions) {
super();
if (req.method !== RequestMethod.Get) {
throw makeTypeError(JSONP_ERR_WRONG_METHOD);

View File

@ -177,8 +177,8 @@ export class MockBackend implements ConnectionBackend {
constructor() {
this.connectionsArray = [];
this.connections = new Subject();
this.connections.subscribe((connection: MockConnection) =>
this.connectionsArray.push(connection));
this.connections.subscribe(
(connection: MockConnection) => this.connectionsArray.push(connection));
this.pendingConnections = new Subject();
}

View File

@ -35,7 +35,7 @@ export class RequestOptions {
* Http method with which to execute a {@link Request}.
* Acceptable methods are defined in the {@link RequestMethod} enum.
*/
method: RequestMethod | string;
method: RequestMethod|string;
/**
* {@link Headers} to be attached to a {@link Request}.
*/
@ -58,9 +58,9 @@ export class RequestOptions {
this.headers = isPresent(headers) ? headers : null;
this.body = isPresent(body) ? body : null;
this.url = isPresent(url) ? url : null;
this.search = isPresent(search) ? (isString(search) ? new URLSearchParams(<string>(search)) :
<URLSearchParams>(search)) :
null;
this.search = isPresent(search) ?
(isString(search) ? new URLSearchParams(<string>(search)) : <URLSearchParams>(search)) :
null;
}
/**
@ -95,9 +95,9 @@ export class RequestOptions {
body: isPresent(options) && isPresent(options.body) ? options.body : this.body,
url: isPresent(options) && isPresent(options.url) ? options.url : this.url,
search: isPresent(options) && isPresent(options.search) ?
(isString(options.search) ? new URLSearchParams(<string>(options.search)) :
(<URLSearchParams>(options.search)).clone()) :
this.search
(isString(options.search) ? new URLSearchParams(<string>(options.search)) :
(<URLSearchParams>(options.search)).clone()) :
this.search
});
}
}

View File

@ -35,7 +35,7 @@ export class ResponseOptions {
/**
* String or Object representing the body of the {@link Response}.
*/
body: string | Object;
body: string|Object;
/**
* Http {@link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html status code}
* associated with the response.

View File

@ -1,20 +1,6 @@
import {
isPresent,
isBlank,
isJsObject,
isType,
StringWrapper,
Json
} from 'angular2/src/facade/lang';
import {isPresent, isBlank, isJsObject, isType, StringWrapper, Json} from 'angular2/src/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
import {
isListLikeIterable,
iterateListLike,
Map,
MapWrapper,
StringMapWrapper,
ListWrapper,
} from 'angular2/src/facade/collection';
import {isListLikeIterable, iterateListLike, Map, MapWrapper, StringMapWrapper, ListWrapper,} from 'angular2/src/facade/collection';
/**
* Polyfill for [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers/Headers), as
@ -45,7 +31,7 @@ import {
export class Headers {
/** @internal */
_headersMap: Map<string, string[]>;
constructor(headers?: Headers | {[key: string]: any}) {
constructor(headers?: Headers|{[key: string]: any}) {
if (headers instanceof Headers) {
this._headersMap = (<Headers>headers)._headersMap;
return;
@ -111,7 +97,7 @@ export class Headers {
/**
* Sets or overrides header value for given name.
*/
set(header: string, value: string | string[]): void {
set(header: string, value: string|string[]): void {
var list: string[] = [];
if (isListLikeIterable(value)) {

View File

@ -12,8 +12,9 @@ function httpRequest(backend: ConnectionBackend, request: Request): Observable<R
return backend.createConnection(request).response;
}
function mergeOptions(defaultOpts: BaseRequestOptions, providedOpts: RequestOptionsArgs,
method: RequestMethod, url: string): RequestOptions {
function mergeOptions(
defaultOpts: BaseRequestOptions, providedOpts: RequestOptionsArgs, method: RequestMethod,
url: string): RequestOptions {
var newOptions = defaultOpts;
if (isPresent(providedOpts)) {
// Hack so Dart can used named parameters
@ -100,7 +101,7 @@ export class Http {
* object can be provided as the 2nd argument. The options object will be merged with the values
* of {@link BaseRequestOptions} before performing the request.
*/
request(url: string | Request, options?: RequestOptionsArgs): Observable<Response> {
request(url: string|Request, options?: RequestOptionsArgs): Observable<Response> {
var responseObservable: any;
if (isString(url)) {
responseObservable = httpRequest(
@ -118,8 +119,9 @@ export class Http {
* Performs a request with `get` http method.
*/
get(url: string, options?: RequestOptionsArgs): Observable<Response> {
return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options,
RequestMethod.Get, url)));
return httpRequest(
this._backend,
new Request(mergeOptions(this._defaultOptions, options, RequestMethod.Get, url)));
}
/**
@ -127,9 +129,9 @@ export class Http {
*/
post(url: string, body: string, options?: RequestOptionsArgs): Observable<Response> {
return httpRequest(
this._backend,
new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})),
options, RequestMethod.Post, url)));
this._backend, new Request(mergeOptions(
this._defaultOptions.merge(new RequestOptions({body: body})), options,
RequestMethod.Post, url)));
}
/**
@ -137,17 +139,18 @@ export class Http {
*/
put(url: string, body: string, options?: RequestOptionsArgs): Observable<Response> {
return httpRequest(
this._backend,
new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})),
options, RequestMethod.Put, url)));
this._backend, new Request(mergeOptions(
this._defaultOptions.merge(new RequestOptions({body: body})), options,
RequestMethod.Put, url)));
}
/**
* Performs a request with `delete` http method.
*/
delete (url: string, options?: RequestOptionsArgs): Observable<Response> {
return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options,
RequestMethod.Delete, url)));
return httpRequest(
this._backend,
new Request(mergeOptions(this._defaultOptions, options, RequestMethod.Delete, url)));
}
/**
@ -155,17 +158,18 @@ export class Http {
*/
patch(url: string, body: string, options?: RequestOptionsArgs): Observable<Response> {
return httpRequest(
this._backend,
new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})),
options, RequestMethod.Patch, url)));
this._backend, new Request(mergeOptions(
this._defaultOptions.merge(new RequestOptions({body: body})), options,
RequestMethod.Patch, url)));
}
/**
* Performs a request with `head` http method.
*/
head(url: string, options?: RequestOptionsArgs): Observable<Response> {
return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options,
RequestMethod.Head, url)));
return httpRequest(
this._backend,
new Request(mergeOptions(this._defaultOptions, options, RequestMethod.Head, url)));
}
}
@ -181,7 +185,7 @@ export class Jsonp extends Http {
* object can be provided as the 2nd argument. The options object will be merged with the values
* of {@link BaseRequestOptions} before performing the request.
*/
request(url: string | Request, options?: RequestOptionsArgs): Observable<Response> {
request(url: string|Request, options?: RequestOptionsArgs): Observable<Response> {
var responseObservable: any;
if (isString(url)) {
url =

View File

@ -7,8 +7,9 @@ export function normalizeMethodName(method: string | RequestMethod): RequestMeth
if (isString(method)) {
var originalMethod = method;
method = (<string>method)
.replace(/(\w)(\w*)/g, (g0: string, g1: string, g2: string) =>
g1.toUpperCase() + g2.toLowerCase());
.replace(
/(\w)(\w*)/g,
(g0: string, g1: string, g2: string) => g1.toUpperCase() + g2.toLowerCase());
method = <number>(<{[key: string]: any}>RequestMethod)[method];
if (typeof method !== 'number')
throw makeTypeError(

View File

@ -28,8 +28,8 @@ export abstract class Connection {
*/
export interface RequestOptionsArgs {
url?: string;
method?: string | RequestMethod;
search?: string | URLSearchParams;
method?: string|RequestMethod;
search?: string|URLSearchParams;
headers?: Headers;
// TODO: Support Blob, ArrayBuffer, JSON, URLSearchParams, FormData
body?: string;
@ -46,10 +46,7 @@ export interface RequestArgs extends RequestOptionsArgs { url: string; }
*/
export type ResponseOptionsArgs = {
// TODO: Support Blob, ArrayBuffer, JSON
body?: string | Object | FormData;
status?: number;
statusText?: string;
headers?: Headers;
body?: string | Object | FormData; status?: number; statusText?: string; headers?: Headers;
type?: ResponseType;
url?: string;
}

View File

@ -2,13 +2,7 @@ import {RequestMethod} from './enums';
import {RequestArgs} from './interfaces';
import {Headers} from './headers';
import {normalizeMethodName} from './http_utils';
import {
RegExpWrapper,
CONST_EXPR,
isPresent,
isJsObject,
StringWrapper
} from 'angular2/src/facade/lang';
import {RegExpWrapper, CONST_EXPR, isPresent, isJsObject, StringWrapper} from 'angular2/src/facade/lang';
// TODO(jeffbcross): properly implement body accessors
/**

View File

@ -72,7 +72,7 @@ export class Response {
*/
headers: Headers;
// TODO: Support ArrayBuffer, JSON, FormData, Blob
private _body: string | Object;
private _body: string|Object;
constructor(responseOptions: ResponseOptions) {
this._body = responseOptions.body;
this.status = responseOptions.status;
@ -92,7 +92,7 @@ export class Response {
* Attempts to return body as parsed `JSON` object, or raises an exception.
*/
json(): any {
var jsonResponse: string | Object;
var jsonResponse: string|Object;
if (isJsObject(this._body)) {
jsonResponse = this._body;
} else if (isString(this._body)) {