Skip to content

Commit c89b600

Browse files
authored
fix: parser-slip-encoder had a breaking change (#2254)
1 parent 85297bc commit c89b600

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

packages/parser-slip-encoder/lib/encoder.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,12 @@ class SlipEncoder extends Transform {
3535
...options,
3636
}
3737
this.opts = opts
38-
39-
if (options.bluetoothQuirk) {
40-
this._bluetoothQuirk = true
41-
}
4238
}
4339

4440
_transform(chunk, encoding, cb) {
4541
const chunkLength = chunk.length
4642

47-
if (this._bluetoothQuirk && chunkLength === 0) {
43+
if (this.opts.bluetoothQuirk && chunkLength === 0) {
4844
// Edge case: push no data. Bluetooth-quirky SLIP parsers don't like
4945
// lots of 0xC0s together.
5046
return cb()
@@ -55,7 +51,7 @@ class SlipEncoder extends Transform {
5551
const encoded = Buffer.alloc(chunkLength * 2 + 2)
5652
let j = 0
5753

58-
if (this._bluetoothQuirk == true) {
54+
if (this.opts.bluetoothQuirk == true) {
5955
encoded[j++] = this.opts.END
6056
}
6157

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
module.exports = {
2-
SlipEncoder: require('./encoder'),
3-
SlipDecoder: require('./decoder'),
4-
}
1+
const SlipEncoder = require('./encoder')
2+
const SlipDecoder = require('./decoder')
3+
4+
module.exports = SlipEncoder
5+
module.exports.SlipEncoder = SlipEncoder
6+
module.exports.SlipDecoder = SlipDecoder

0 commit comments

Comments
 (0)