cbuffer icon indicating copy to clipboard operation
cbuffer copied to clipboard

convenience method for length

Open futurechan opened this issue 10 years ago • 5 comments

Is there a way to get the total number of items in the buffer?

Also, I want to completely dump the buffer by calling .pop() in iteration. Can I call .pop and then check the size until the size is zero?

futurechan avatar Nov 19 '14 16:11 futurechan

I ended up calling .pop() and then checking if the result is undefined, but I'm still curious if there is a way to continuously check the size of the buffer without calling .toArray().length.

futurechan avatar Nov 19 '14 17:11 futurechan

b.size is what you want.

trevnorris avatar Dec 03 '14 07:12 trevnorris

Actually, leaving open as a reminder this needs to be documented.

trevnorris avatar Dec 03 '14 07:12 trevnorris

What would be really nice is a remaining size. :)

matbee-eth avatar Feb 04 '15 04:02 matbee-eth

@acidhax Could add a convince method, but should only need cb.length - cb.size.

trevnorris avatar Feb 04 '15 19:02 trevnorris