git ssb

0+

wanderer🌟 / buffer-pipe



Commit 54caadc458ca1ac4c3d5d42c945f09165d3f15cd

add end prop

wanderer committed on 12/5/2017, 6:22:15 PM
Parent: 83cb9ce730be6f7f6236af5fd664d57a6a74acc9

Files changed

index.jschanged
tests/index.jschanged
index.jsView
@@ -27,5 +27,13 @@
2727 write (buf) {
2828 buf = Buffer.from(buf)
2929 this.buffer = Buffer.concat([this.buffer, buf])
3030 }
31 +
32 + /**
33 + * Whether or not there is more data to read from the buffer
34 + * returns {Boolean}
35 + */
36 + get end () {
37 + return !this.buffer.length
38 + }
3139 }
tests/index.jsView
@@ -9,8 +9,9 @@
99
1010 const buf = p.read(3)
1111
1212 t.deepEquals(buf, Buffer.from([1, 2, 3]))
13 + t.equal(p.end, false)
1314
1415 p = new Pipe()
1516 p.write(Buffer.from([99]))
1617

Built with git-ssb-web