bigeasy / packet

Incremental binary parsers and serializers for Node.js.

Home Page:http://bigeasy.github.io/packet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty array should yield empty output

sukovec opened this issue · comments

Hello,

I find your library pretty useful, but there is one thing that I believe may be a bug. An empty length-prefixed array should yield just the prefix.

For example:
Pattern: l8 => numero, l8/l8 => arr, l8 => other
Test object: { "numero": 8, "arr": [], "other": 10 }
Output: <Buffer 08 00 00 0a>
Expected output: <Buffer 08 00 0a>

Maybe I misunderstood or missed something, but I would expect, that empty array with length 0 contains nothing, not even a zero as it is a array with one (yet useless) item.