JoshGlazebrook / smart-buffer

smart-buffer is a Buffer wrapper that adds automatic read & write offset tracking, string operations, data insertions, and more.
https://www.npmjs.com/package/smart-buffer
MIT License
102 stars 18 forks source link

Special case `readString` when the length is equals to 0 #12

Closed Seldszar closed 7 years ago

Seldszar commented 7 years ago

When the readString length parameter is equal to 0, this one is considered as a null value and the function reads until the end and I think this is not the correct behavior.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling abe80ae0c0c1a6f5ec757d83cd04e58c722ccf58 on Seldszar:patch/readstring-zero into bb22df0041732107dcd7492e33dae1c5b63af0ff on JoshGlazebrook:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling abe80ae0c0c1a6f5ec757d83cd04e58c722ccf58 on Seldszar:patch/readstring-zero into bb22df0041732107dcd7492e33dae1c5b63af0ff on JoshGlazebrook:master.

JoshGlazebrook commented 7 years ago

Nice catch and addition. I'll publish this in 3.0.2.