Merge pull request #13 from justmoon/fix/bytesRead-to-bytes

Fix typo bytesRead -> bytes
master
Chris Dickinson 8 years ago committed by GitHub
commit f04024540c

@ -10,10 +10,11 @@ function read(buf, offset) {
, counter = offset , counter = offset
, b , b
, l = buf.length , l = buf.length
do { do {
if(counter >= l) { if(counter >= l) {
read.bytesRead = 0 read.bytes = 0
read.bytesRead = 0 // DEPRECATED
return undefined return undefined
} }
b = buf[counter++] b = buf[counter++]
@ -22,8 +23,8 @@ function read(buf, offset) {
: (b & REST) * Math.pow(2, shift) : (b & REST) * Math.pow(2, shift)
shift += 7 shift += 7
} while (b >= MSB) } while (b >= MSB)
read.bytes = counter - offset read.bytes = counter - offset
return res return res
} }

@ -126,6 +126,7 @@ test('buffer too short', function (assert) {
while(l--) { while(l--) {
var val = decode(buffer.slice(0, l)) var val = decode(buffer.slice(0, l))
assert.equal(val, undefined) assert.equal(val, undefined)
assert.equal(decode.bytes, 0)
assert.equal(decode.bytesRead, 0) assert.equal(decode.bytesRead, 0)
} }
assert.end() assert.end()

Loading…
Cancel
Save