Skip to content
This repository was archived by the owner on Sep 6, 2018. It is now read-only.

Commit d19b4d4

Browse files
Carlos LanchaMichael Hadley
Carlos Lancha
authored and
Michael Hadley
committed
Use for of instead for
1 parent 905b56d commit d19b4d4

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/config.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,13 @@ export function validateConfig(config: Config): Config {
3232
throw new Error('callToImport is not a valid config array.');
3333
}
3434

35-
for (let i=0; i < config.callToImport.length; i++) {
36-
let callToImportItem = config.callToImport[i];
37-
38-
if (!isRegex(callToImportItem.regex)) {
39-
throw new Error(`callToImport.regex "${callToImportItem.regex}" is not a valid RegExp.`);
35+
for (const item of config.callToImport) {
36+
if (!isRegex(item.regex)) {
37+
throw new Error(`callToImport.regex "${item.regex}" is not a valid RegExp.`);
4038
}
4139

42-
if (!isRegex(callToImportItem.replace)) {
43-
throw new Error(`callToImport.replace "${callToImportItem.replace}" is not a valid replace string.`);
40+
if (!isRegex(item.replace)) {
41+
throw new Error(`callToImport.replace "${item.replace}" is not a valid replace string.`);
4442
}
4543
}
4644

src/validate-call-imports.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export default function valdiateCallImports(soyContext: SoyContext, jsContext: J
4040

4141
const missingImports = getExternalSoyCalls(soyContext)
4242
.filter(name => {
43-
for (let i=0; i < config.callToImport.length; i++) {
44-
let transformedName = transform(name, config.callToImport[i].regex, config.callToImport[i].replace);
43+
for (const item of config.callToImport) {
44+
let transformedName = transform(name, item.regex, item.replace);
4545

4646
if (importNames.find(importName => importName.includes(transformedName))) {
4747
return false;

0 commit comments

Comments
 (0)