Skip to content

Commit

Permalink
remove unnecessary destroy method
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Jul 4, 2024
1 parent 24b6d10 commit ff115a7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ Misc methods:
* `realloc(minBytes)` - pad the underlying buffer size to accommodate the given number of bytes;
note that the size increases exponentially, so it won't necessarily equal the size of data written
* `finish()` - make the current buffer ready for reading and return the data as a buffer slice
* `destroy()` - dispose the buffer

For an example of a real-world usage of the library, see [vector-tile-js](https:/mapbox/vector-tile-js).

Expand Down
5 changes: 0 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ export default class Pbf {
this.length = this.buf.length;
}

destroy() {
this.buf = null;
this.dataView = null;
}

// === READING =================================================================

readFields(readField, result, end = this.length) {
Expand Down
3 changes: 1 addition & 2 deletions test/pbf.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ function toArray(buf) {
}

test('initialization', () => {
const buf = new Pbf(Buffer.alloc(0));
buf.destroy();
assert.doesNotThrow(() => new Pbf(Buffer.alloc(0)));
});

test('realloc', () => {
Expand Down

0 comments on commit ff115a7

Please sign in to comment.