diff --git a/README.md b/README.md index bf2d49c..b66d513 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,10 @@ Throws error if unable to decode message. - `data` {Buffer|ArrayBuffer|Uint8Array|string} Data to decode. - `offset?` {integer} Offset of the message start in the passed data. **Default:** `0`. - Returns: {Object}: - - `value?` {any} Decoded data. - - `offset?` {integer} Offset of the decoded message end in the passed data. + - `value` {any} Decoded data. + - `offset` {integer} Offset of the decoded message end in the passed data. -Returns empty {Object} if message is incomplete. +Returns {undefined} if message is incomplete. Throws error if unable to decode message. diff --git a/docs/README.md b/docs/README.md index 34fcf9e..a52b789 100644 --- a/docs/README.md +++ b/docs/README.md @@ -42,10 +42,10 @@ Throws error if unable to decode message. - `data` {Buffer|ArrayBuffer|Uint8Array|string} Data to decode. - `offset?` {integer} Offset of the message start in the passed data. **Default:** `0`. - Returns: {Object}: - - `value?` {any} Decoded data. - - `offset?` {integer} Offset of the decoded message end in the passed data. + - `value` {any} Decoded data. + - `offset` {integer} Offset of the decoded message end in the passed data. -Returns empty {Object} if message is incomplete. +Returns {undefined} if message is incomplete. Throws error if unable to decode message. diff --git a/lib/decode.js b/lib/decode.js index c4f6c79..b2ea296 100644 --- a/lib/decode.js +++ b/lib/decode.js @@ -436,7 +436,7 @@ export function decodeStream ( buffer, offset ) { // message is incomplete if ( decoder.rangeError || e.code === "ERR_BUFFER_OUT_OF_BOUNDS" || e.code === "ERR_OUT_OF_RANGE" ) { - return {}; + return; } throw e;