Skip to content

Commit 3533cac

Browse files
committed
Readability improvement
Pull `fromSource` in `walk`'s resolve callback into the same scope level as `fromDeps`.
1 parent ba2e9f2 commit 3533cac

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ Deps.prototype.walk = function (id, parent, cb) {
332332
var ts = self.getTransforms(file, pkg);
333333
ts.pipe(concat(function (body) {
334334
rec.source = body.toString('utf8');
335-
fromSource(rec.source);
335+
fromSource(file, rec.source, pkg);
336336
}));
337337
return ts.end(rec.source);
338338
}
@@ -354,7 +354,7 @@ Deps.prototype.walk = function (id, parent, cb) {
354354
var ts = self.getTransforms(file, pkg);
355355
ts.pipe(concat(function (body) {
356356
rec.source = body.toString('utf8');
357-
fromSource(rec.source);
357+
fromSource(file, rec.source, pkg);
358358
}));
359359
return ts.end(rec.source);
360360
}
@@ -367,15 +367,15 @@ Deps.prototype.walk = function (id, parent, cb) {
367367
builtin: has(parent.modules, id)
368368
}))
369369
.pipe(concat(function (body) {
370-
fromSource(body.toString('utf8'));
370+
fromSource(file, body.toString('utf8'), pkg);
371371
}))
372372
;
373-
374-
function fromSource (src) {
375-
var deps = rec.noparse ? [] : self.parseDeps(file, src);
376-
if (deps) fromDeps(file, src, pkg, deps);
377-
}
378373
});
374+
375+
function fromSource (file, src, pkg) {
376+
var deps = rec.noparse ? [] : self.parseDeps(file, src);
377+
if (deps) fromDeps(file, src, pkg, deps);
378+
}
379379

380380
function fromDeps (file, src, pkg, deps) {
381381
var p = deps.length;

0 commit comments

Comments
 (0)