refactor(): use const and let instead of var
This commit is contained in:

committed by
Victor Berchet

parent
73593d4bf3
commit
77ee27c59e
@ -151,8 +151,8 @@ export class MockDirectiveResolver extends DirectiveResolver {
|
||||
|
||||
function flattenArray(tree: any[], out: Array<Type<any>|any[]>): void {
|
||||
if (!isPresent(tree)) return;
|
||||
for (var i = 0; i < tree.length; i++) {
|
||||
var item = resolveForwardRef(tree[i]);
|
||||
for (let i = 0; i < tree.length; i++) {
|
||||
const item = resolveForwardRef(tree[i]);
|
||||
if (Array.isArray(item)) {
|
||||
flattenArray(item, out);
|
||||
} else {
|
||||
|
@ -46,7 +46,7 @@ export class MetadataOverrider {
|
||||
|
||||
function removeMetadata(metadata: StringMap, remove: any, references: Map<any, string>) {
|
||||
const removeObjects = new Set<string>();
|
||||
for (let prop in remove) {
|
||||
for (const prop in remove) {
|
||||
const removeValue = remove[prop];
|
||||
if (removeValue instanceof Array) {
|
||||
removeValue.forEach(
|
||||
@ -56,7 +56,7 @@ function removeMetadata(metadata: StringMap, remove: any, references: Map<any, s
|
||||
}
|
||||
}
|
||||
|
||||
for (let prop in metadata) {
|
||||
for (const prop in metadata) {
|
||||
const propValue = metadata[prop];
|
||||
if (propValue instanceof Array) {
|
||||
metadata[prop] = propValue.filter(
|
||||
@ -70,7 +70,7 @@ function removeMetadata(metadata: StringMap, remove: any, references: Map<any, s
|
||||
}
|
||||
|
||||
function addMetadata(metadata: StringMap, add: any) {
|
||||
for (let prop in add) {
|
||||
for (const prop in add) {
|
||||
const addValue = add[prop];
|
||||
const propValue = metadata[prop];
|
||||
if (propValue != null && propValue instanceof Array) {
|
||||
@ -82,7 +82,7 @@ function addMetadata(metadata: StringMap, add: any) {
|
||||
}
|
||||
|
||||
function setMetadata(metadata: StringMap, set: any) {
|
||||
for (let prop in set) {
|
||||
for (const prop in set) {
|
||||
metadata[prop] = set[prop];
|
||||
}
|
||||
}
|
||||
@ -121,7 +121,7 @@ function _valueProps(obj: any): string[] {
|
||||
let proto = obj;
|
||||
while (proto = Object.getPrototypeOf(proto)) {
|
||||
Object.keys(proto).forEach((protoProp) => {
|
||||
var desc = Object.getOwnPropertyDescriptor(proto, protoProp);
|
||||
const desc = Object.getOwnPropertyDescriptor(proto, protoProp);
|
||||
if (!protoProp.startsWith('_') && desc && 'get' in desc) {
|
||||
props.push(protoProp);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ export class MockPipeResolver extends PipeResolver {
|
||||
* `PipeResolver`, see `setPipe`.
|
||||
*/
|
||||
resolve(type: Type<any>, throwIfNotFound = true): Pipe {
|
||||
var metadata = this._pipes.get(type);
|
||||
let metadata = this._pipes.get(type);
|
||||
if (!metadata) {
|
||||
metadata = super.resolve(type, throwIfNotFound);
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ export class MockResourceLoader extends ResourceLoader {
|
||||
verifyNoOutstandingExpectations() {
|
||||
if (this._expectations.length === 0) return;
|
||||
|
||||
var urls: string[] = [];
|
||||
for (var i = 0; i < this._expectations.length; i++) {
|
||||
var expectation = this._expectations[i];
|
||||
const urls: string[] = [];
|
||||
for (let i = 0; i < this._expectations.length; i++) {
|
||||
const expectation = this._expectations[i];
|
||||
urls.push(expectation.url);
|
||||
}
|
||||
|
||||
@ -77,10 +77,10 @@ export class MockResourceLoader extends ResourceLoader {
|
||||
}
|
||||
|
||||
private _processRequest(request: _PendingRequest) {
|
||||
var url = request.url;
|
||||
const url = request.url;
|
||||
|
||||
if (this._expectations.length > 0) {
|
||||
var expectation = this._expectations[0];
|
||||
const expectation = this._expectations[0];
|
||||
if (expectation.url == url) {
|
||||
ListWrapper.remove(this._expectations, expectation);
|
||||
request.complete(expectation.response);
|
||||
@ -89,7 +89,7 @@ export class MockResourceLoader extends ResourceLoader {
|
||||
}
|
||||
|
||||
if (this._definitions.has(url)) {
|
||||
var response = this._definitions.get(url);
|
||||
const response = this._definitions.get(url);
|
||||
request.complete(response == null ? null : response);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user