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

committed by
Victor Berchet

parent
73593d4bf3
commit
77ee27c59e
@ -15,11 +15,11 @@ export class StringMapWrapper {
|
||||
static merge<V>(m1: {[key: string]: V}, m2: {[key: string]: V}): {[key: string]: V} {
|
||||
const m: {[key: string]: V} = {};
|
||||
|
||||
for (let k of Object.keys(m1)) {
|
||||
for (const k of Object.keys(m1)) {
|
||||
m[k] = m1[k];
|
||||
}
|
||||
|
||||
for (let k of Object.keys(m2)) {
|
||||
for (const k of Object.keys(m2)) {
|
||||
m[k] = m2[k];
|
||||
}
|
||||
|
||||
@ -99,8 +99,8 @@ export function areIterablesEqual(
|
||||
const iterator2 = b[getSymbolIterator()]();
|
||||
|
||||
while (true) {
|
||||
let item1 = iterator1.next();
|
||||
let item2 = iterator2.next();
|
||||
const item1 = iterator1.next();
|
||||
const item2 = iterator2.next();
|
||||
if (item1.done && item2.done) return true;
|
||||
if (item1.done || item2.done) return false;
|
||||
if (!comparator(item1.value, item2.value)) return false;
|
||||
|
@ -23,7 +23,7 @@ export class NumberFormatter {
|
||||
currency?: string,
|
||||
currencyAsSymbol?: boolean
|
||||
} = {}): string {
|
||||
let options: Intl.NumberFormatOptions = {
|
||||
const options: Intl.NumberFormatOptions = {
|
||||
minimumIntegerDigits,
|
||||
minimumFractionDigits,
|
||||
maximumFractionDigits,
|
||||
@ -180,7 +180,7 @@ function datePartGetterFactory(ret: Intl.DateTimeFormatOptions): DateFormatterFn
|
||||
const DATE_FORMATTER_CACHE = new Map<string, string[]>();
|
||||
|
||||
function dateFormatter(format: string, date: Date, locale: string): string {
|
||||
let fn = PATTERN_ALIASES[format];
|
||||
const fn = PATTERN_ALIASES[format];
|
||||
|
||||
if (fn) return fn(date, locale);
|
||||
|
||||
@ -206,7 +206,7 @@ function dateFormatter(format: string, date: Date, locale: string): string {
|
||||
}
|
||||
|
||||
return parts.reduce((text, part) => {
|
||||
let fn = DATE_FORMATS[part];
|
||||
const fn = DATE_FORMATS[part];
|
||||
return text + (fn ? fn(date, locale) : partToTime(part));
|
||||
}, '');
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ declare var WorkerGlobalScope: any /** TODO #9100 */;
|
||||
// the global "global" var for now.
|
||||
declare var global: any /** TODO #9100 */;
|
||||
|
||||
var globalScope: BrowserNodeGlobal;
|
||||
let globalScope: BrowserNodeGlobal;
|
||||
if (typeof window === 'undefined') {
|
||||
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
|
||||
// TODO: Replace any with WorkerGlobalScope from lib.webworker.d.ts #3492
|
||||
@ -154,7 +154,7 @@ export function setValueOnPath(global: any, path: string, value: any) {
|
||||
}
|
||||
|
||||
// When Symbol.iterator doesn't exist, retrieves the key used in es6-shim
|
||||
declare let Symbol: any;
|
||||
declare const Symbol: any;
|
||||
let _symbolIterator: any = null;
|
||||
export function getSymbolIterator(): string|symbol {
|
||||
if (!_symbolIterator) {
|
||||
@ -164,7 +164,7 @@ export function getSymbolIterator(): string|symbol {
|
||||
// es6-shim specific logic
|
||||
const keys = Object.getOwnPropertyNames(Map.prototype);
|
||||
for (let i = 0; i < keys.length; ++i) {
|
||||
let key = keys[i];
|
||||
const key = keys[i];
|
||||
if (key !== 'entries' && key !== 'size' &&
|
||||
(Map as any).prototype[key] === Map.prototype['entries']) {
|
||||
_symbolIterator = key;
|
||||
|
Reference in New Issue
Block a user