Skip to content

Commit

Permalink
Use forEach in lib/middleware/karma.js
Browse files Browse the repository at this point in the history
Use `forEach` instead of `for..in` as it's better
practices and fix #2671.
  • Loading branch information
BenjaminVanRyseghem committed Apr 27, 2017
1 parent 03958ce commit 6fed42b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/middleware/karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ var createKarmaMiddleware = function (

var scriptTags = []
var scriptUrls = []
for (var i in files.included) {
files.included.forEach(function(file) {
var file = files.included[i]
var filePath = file.path
var fileExt = path.extname(filePath)

if (!files.included.hasOwnProperty(i)) {
continue
return;
}

if (!file.isUrl) {
Expand All @@ -195,12 +195,12 @@ var createKarmaMiddleware = function (

if (fileExt === '.css') {
scriptTags.push(util.format(LINK_TAG_CSS, filePath))
continue
return;
}

if (fileExt === '.html') {
scriptTags.push(util.format(LINK_TAG_HTML, filePath))
continue
return;
}

// The script tag to be placed
Expand All @@ -213,7 +213,7 @@ var createKarmaMiddleware = function (

var crossOriginAttribute = includeCrossOriginAttribute ? CROSSORIGIN_ATTRIBUTE : ''
scriptTags.push(util.format(SCRIPT_TAG, scriptType, filePath, crossOriginAttribute))
}
});

// TODO(vojta): don't compute if it's not in the template
var mappings = files.served.map(function (file) {
Expand Down

0 comments on commit 6fed42b

Please sign in to comment.