Skip to content

Commit

Permalink
Updated standard@16 (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina authored Jun 7, 2021
1 parent 5e92dcd commit bb79b09
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"devDependencies": {
"pre-commit": "^1.2.2",
"readable-stream": "^3.6.0",
"standard": "^14.3.4",
"standard": "^16.0.0",
"tap-spec": "^5.0.0",
"tape": "^5.0.1"
},
Expand Down
15 changes: 9 additions & 6 deletions parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,15 @@ class Parser extends EventEmitter {
this._pos += bytes
}

result = result
? fullInfoFlag ? {
bytes,
value
} : value
: false
if (result) {
if (fullInfoFlag) {
result = { bytes, value }
} else {
result = value
}
} else {
result = false
}

debug('_parseVarByteNum: result: %o', result)
return result
Expand Down
6 changes: 3 additions & 3 deletions testRandom.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const mqtt = require('./')
const crypto = require('crypto')
const max = 1E5
const start = Date.now() / 1000
var errors = 0
var packets = 0
var randomPacket
let errors = 0
let packets = 0
let randomPacket
const firstBytes = [
16 * 1, // CONNECT
16 * 2, // CONNACK
Expand Down
7 changes: 5 additions & 2 deletions writeToStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,12 @@ function connect (packet, stream, opts) {
// Connect flags
length += 1

let propertiesData
let willProperties

// Properties
if (protocolVersion === 5) {
var propertiesData = getProperties(stream, properties)
propertiesData = getProperties(stream, properties)
if (!propertiesData) { return false }
length += propertiesData.length
}
Expand Down Expand Up @@ -174,7 +177,7 @@ function connect (packet, stream, opts) {
}
}
// will properties
var willProperties = {}
willProperties = {}
if (protocolVersion === 5) {
willProperties = getProperties(stream, will.properties)
if (!willProperties) { return false }
Expand Down

0 comments on commit bb79b09

Please sign in to comment.