Skip to content

Commit 5c4052f

Browse files
committed
[Refactor] avoid reassigning arguments
1 parent da0cdf1 commit 5c4052f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

index.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ module.exports = (function () {
2323
};
2424

2525
lazyLoad.createStream = function (opts) {
26-
if (!opts) opts = {};
26+
var options = opts || {};
2727
if (!harness) {
2828
var output = through();
29-
getHarness({ stream: output, objectMode: opts.objectMode });
29+
getHarness({ stream: output, objectMode: options.objectMode });
3030
return output;
3131
}
32-
return harness.createStream(opts);
32+
return harness.createStream(options);
3333
};
3434

3535
lazyLoad.onFinish = function () {
@@ -53,9 +53,9 @@ module.exports = (function () {
5353
})();
5454

5555
function createExitHarness(conf) {
56-
if (!conf) conf = {};
56+
var config = conf || {};
5757
var harness = createHarness({
58-
autoclose: defined(conf.autoclose, false)
58+
autoclose: defined(config.autoclose, false)
5959
});
6060

6161
var stream = harness.createStream({ objectMode: conf.objectMode });
@@ -67,7 +67,7 @@ function createExitHarness(conf) {
6767
var ended = false;
6868
stream.on('end', function () { ended = true; });
6969

70-
if (conf.exit === false) return harness;
70+
if (config.exit === false) return harness;
7171
if (!canEmitExit || !canExit) return harness;
7272

7373
process.on('exit', function (code) {
@@ -97,9 +97,8 @@ module.exports.test = module.exports; // tap compat
9797
module.exports.test.skip = Test.skip;
9898

9999
function createHarness(conf_) {
100-
if (!conf_) conf_ = {};
101100
var results = createResult();
102-
if (conf_.autoclose !== false) {
101+
if (!conf_ || conf_.autoclose !== false) {
103102
results.once('done', function () { results.close(); });
104103
}
105104

0 commit comments

Comments
 (0)