Skip to content

Commit

Permalink
Update: Cleanup loadSourcesAsync iteration with async.each
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Jun 17, 2017
1 parent c0119ed commit 78265cc
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ module.exports.add = function add (file, options, cb) {
var fixImportedSourceMap = function () {
sourceMap.sourcesContent = sourceMap.sourcesContent || [];

var loadCounter = 0;
var loadSourceAsync = function (source, onLoaded) {
var i = source[0],
absPath = source[1];
Expand Down Expand Up @@ -133,18 +132,7 @@ module.exports.add = function add (file, options, cb) {
// remove source map comment from source
file.contents = new Buffer(fileContent, 'utf8');

if (sourcesToLoadAsync.length) {
sourcesToLoadAsync.forEach(function(source) {
loadSourceAsync(source, function onLoaded () {
if (++loadCounter === sourcesToLoadAsync.length) {
callback(null);
}
});
});
} else {
callback(null);
}

async.each(sourcesToLoadAsync, loadSourceAsync, callback);
};

var loadSourceMap = function (callback) {
Expand Down

0 comments on commit 78265cc

Please sign in to comment.