Skip to content

Commit 8b4b829

Browse files
authored
Merge pull request #23 from LinusU/prefer-const
Prefer const over let
2 parents bfc1dba + da27972 commit 8b4b829

2 files changed

Lines changed: 57 additions & 57 deletions

File tree

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ module.exports = merge2
1515
function merge2 () {
1616
const streamsQueue = []
1717
let merging = false
18-
let args = slice.call(arguments)
18+
const args = slice.call(arguments)
1919
let options = args[args.length - 1]
2020

2121
if (options && !Array.isArray(options) && options.pipe == null) args.pop()
2222
else options = {}
2323

24-
let doEnd = options.end !== false
24+
const doEnd = options.end !== false
2525
if (options.objectMode == null) options.objectMode = true
2626
if (options.highWaterMark == null) options.highWaterMark = 64 * 1024
2727
const mergedStream = PassThrough(options)

test/index.js

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ test(require('@std/esm')(module)('../index.mjs').default)
1313
function test (merge2) {
1414
tman.suite('merge2', function () {
1515
tman.it('merge2(read1, read2, through3)', function (done) {
16-
let options = {objectMode: true}
17-
let result = []
18-
let read1 = fakeReadStream(options)
19-
let read2 = fakeReadStream(options)
20-
let through3 = through.obj()
16+
const options = {objectMode: true}
17+
const result = []
18+
const read1 = fakeReadStream(options)
19+
const read2 = fakeReadStream(options)
20+
const through3 = through.obj()
2121

22-
let mergeStream = merge2(read1, read2, through3)
22+
const mergeStream = merge2(read1, read2, through3)
2323

2424
read1.push(1)
2525
thunk.delay(100)(function () {
@@ -49,10 +49,10 @@ function test (merge2) {
4949
})
5050

5151
tman.it('merge2(TransformStream)', function (done) {
52-
let result = []
53-
let ts = through.obj()
52+
const result = []
53+
const ts = through.obj()
5454

55-
let mergeStream = merge2(toThrough(ts))
55+
const mergeStream = merge2(toThrough(ts))
5656

5757
ts.push(1)
5858
thunk.delay(100)(function () {
@@ -72,14 +72,14 @@ function test (merge2) {
7272
})
7373

7474
tman.it('merge2(read1, [read2, through3], through4, [through5, read6])', function (done) {
75-
let options = {objectMode: true}
76-
let result = []
77-
let read1 = fakeReadStream(options)
78-
let read2 = fakeReadStream(options)
79-
let through3 = through.obj()
80-
let through4 = through.obj()
81-
let through5 = through.obj()
82-
let read6 = fakeReadStream(options)
75+
const options = {objectMode: true}
76+
const result = []
77+
const read1 = fakeReadStream(options)
78+
const read2 = fakeReadStream(options)
79+
const through3 = through.obj()
80+
const through4 = through.obj()
81+
const through5 = through.obj()
82+
const read6 = fakeReadStream(options)
8383

8484
read1.push(1)
8585
read1.push(null)
@@ -98,7 +98,7 @@ function test (merge2) {
9898
read6.push(null)
9999
})
100100

101-
let mergeStream = merge2(read1, [read2, through3], through4, [through5, read6])
101+
const mergeStream = merge2(read1, [read2, through3], through4, [through5, read6])
102102

103103
mergeStream
104104
.on('data', function (chunk) {
@@ -112,15 +112,15 @@ function test (merge2) {
112112
})
113113

114114
tman.it('merge2().add(read1, [read2, through3], through4, [through5, read6])', function (done) {
115-
let options = {objectMode: true}
116-
let result = []
117-
let read1 = fakeReadStream(options)
118-
let read2 = fakeReadStream(options)
119-
let through3 = through.obj()
120-
let through4 = through.obj()
121-
let through5 = through.obj()
122-
let read6 = fakeReadStream(options)
123-
let mergeStream = merge2()
115+
const options = {objectMode: true}
116+
const result = []
117+
const read1 = fakeReadStream(options)
118+
const read2 = fakeReadStream(options)
119+
const through3 = through.obj()
120+
const through4 = through.obj()
121+
const through5 = through.obj()
122+
const read6 = fakeReadStream(options)
123+
const mergeStream = merge2()
124124

125125
read1.push(1)
126126
read1.push(null)
@@ -153,13 +153,13 @@ function test (merge2) {
153153
})
154154

155155
tman.it('merge2(read1, read2, through3, {objectMode: false})', function (done) {
156-
let options = {objectMode: false}
156+
const options = {objectMode: false}
157157
let result = ''
158-
let read1 = fakeReadStream(options)
159-
let read2 = fakeReadStream(options)
160-
let through3 = through(options)
158+
const read1 = fakeReadStream(options)
159+
const read2 = fakeReadStream(options)
160+
const through3 = through(options)
161161

162-
let mergeStream = merge2(read1, read2, through3, options)
162+
const mergeStream = merge2(read1, read2, through3, options)
163163

164164
read1.push('1')
165165
thunk.delay(100)(function () {
@@ -189,11 +189,11 @@ function test (merge2) {
189189
})
190190

191191
tman.it('merge2([read1, read2]) with classic style streams', function (done) {
192-
let result = []
193-
let read1 = fakeReadClassicStream()
194-
let read2 = fakeReadClassicStream()
192+
const result = []
193+
const read1 = fakeReadClassicStream()
194+
const read2 = fakeReadClassicStream()
195195

196-
let mergeStream = merge2([read1, read2])
196+
const mergeStream = merge2([read1, read2])
197197

198198
read1.push(1)
199199
read1.push(null)
@@ -214,13 +214,13 @@ function test (merge2) {
214214
})
215215

216216
tman.it('merge2(read1, read2, {end: false})', function (done) {
217-
let options = {objectMode: true}
218-
let result = []
219-
let read1 = fakeReadStream(options)
220-
let read2 = fakeReadStream(options)
221-
let through3 = through.obj()
217+
const options = {objectMode: true}
218+
const result = []
219+
const read1 = fakeReadStream(options)
220+
const read2 = fakeReadStream(options)
221+
const through3 = through.obj()
222222

223-
let mergeStream = merge2(read1, read2, {end: false})
223+
const mergeStream = merge2(read1, read2, {end: false})
224224

225225
read1.push(1)
226226
read1.push(2)
@@ -252,15 +252,15 @@ function test (merge2) {
252252
})
253253

254254
tman.it('merge2(merge2(through4, [through5, read6]), read1, [read2, through3])', function (done) {
255-
let options = {objectMode: true}
256-
let result1 = []
257-
let result2 = []
258-
let read1 = fakeReadStream(options)
259-
let read2 = fakeReadStream(options)
260-
let through3 = through.obj()
261-
let through4 = through.obj()
262-
let through5 = through.obj()
263-
let read6 = fakeReadStream(options)
255+
const options = {objectMode: true}
256+
const result1 = []
257+
const result2 = []
258+
const read1 = fakeReadStream(options)
259+
const read2 = fakeReadStream(options)
260+
const through3 = through.obj()
261+
const through4 = through.obj()
262+
const through5 = through.obj()
263+
const read6 = fakeReadStream(options)
264264

265265
read1.push(1)
266266
read1.push(null)
@@ -279,13 +279,13 @@ function test (merge2) {
279279
read6.push(null)
280280
})
281281

282-
let mergeStream1 = merge2(through4, [through5, read6])
282+
const mergeStream1 = merge2(through4, [through5, read6])
283283

284284
mergeStream1.on('data', function (chunk) {
285285
result1.push(chunk)
286286
})
287287

288-
let mergeStream = merge2(mergeStream1, read1, [read2, through3])
288+
const mergeStream = merge2(mergeStream1, read1, [read2, through3])
289289

290290
mergeStream
291291
.on('data', function (chunk) {
@@ -303,13 +303,13 @@ function test (merge2) {
303303
}
304304

305305
function fakeReadStream (options) {
306-
let readStream = new Stream.Readable(options)
306+
const readStream = new Stream.Readable(options)
307307
readStream._read = function () {}
308308
return readStream
309309
}
310310

311311
function fakeReadClassicStream () {
312-
let readStream = new Stream()
312+
const readStream = new Stream()
313313
readStream.readable = true
314314
readStream.push = function (data) {
315315
if (data === null) {

0 commit comments

Comments
 (0)