refactor(): use const and let instead of var

This commit is contained in:
Joao Dias
2016-11-12 14:08:58 +01:00
committed by Victor Berchet
parent 73593d4bf3
commit 77ee27c59e
435 changed files with 4637 additions and 4663 deletions

View File

@ -245,7 +245,7 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry {
constructor() {
super();
SCHEMA.forEach(encodedType => {
let type: {[property: string]: string} = {};
const type: {[property: string]: string} = {};
const [strType, strProperties] = encodedType.split('|');
const properties = strProperties.split(',');
const [typeNames, superName] = strType.split('^');
@ -383,15 +383,15 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry {
normalizeAnimationStyleValue(camelCaseProp: string, userProvidedProp: string, val: string|number):
{error: string, value: string} {
var unit: string = '';
var strVal = val.toString().trim();
var errorMsg: string = null;
let unit: string = '';
const strVal = val.toString().trim();
let errorMsg: string = null;
if (_isPixelDimensionStyle(camelCaseProp) && val !== 0 && val !== '0') {
if (typeof val === 'number') {
unit = 'px';
} else {
let valAndSuffixMatch = val.match(/^[+-]?[\d\.]+([a-z]*)$/);
const valAndSuffixMatch = val.match(/^[+-]?[\d\.]+([a-z]*)$/);
if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) {
errorMsg = `Please provide a CSS unit value for ${userProvidedProp}:${val}`;
}

View File

@ -23,7 +23,7 @@ import {SecurityContext} from '@angular/core';
export const SECURITY_SCHEMA: {[k: string]: SecurityContext} = {};
function registerContext(ctx: SecurityContext, specs: string[]) {
for (let spec of specs) SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
for (const spec of specs) SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
}
// Case is insignificant below, all element and attribute names are lower-cased for lookup.