Skip to content

Commit f12fef0

Browse files
committed
feat: Added done getter
1 parent bdda714 commit f12fef0

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

deno.jsonc renamed to deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@typescriptplayground/binary-reader",
3-
"version": "0.2.2",
3+
"version": "0.3.0",
44
"license": "./LICENSE",
55
"exports": "./src/index.ts",
66
"tasks": {

src/data_reader.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ export default class DataReader {
3131
return this.bufferData.slice(this.pointer);
3232
}
3333

34+
/**
35+
* This getter returns if the reader has nothing left to read.
36+
*
37+
* @returns If the reader is done reading.
38+
*/
39+
public get done() : boolean {
40+
return this.pointer == (this.bufferData.byteLength - 1);
41+
}
42+
3443
/**
3544
* This instance function reads `n` bytes and pushes the pointer accordingly.
3645
*

0 commit comments

Comments
 (0)