bin-serde 1.7.4 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +2 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -3
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -154,9 +154,8 @@ export class Writer {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
toBuffer() {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
: this.bytes.slice(0, this.pos);
|
|
157
|
+
const view = this.bytes.subarray(0, this.pos);
|
|
158
|
+
return typeof Buffer !== "undefined" ? Buffer.from(view) : view.slice();
|
|
160
159
|
}
|
|
161
160
|
|
|
162
161
|
reset() {
|
package/lib/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare class Writer {
|
|
|
14
14
|
writeStringUtf8(val: string, len?: number): this;
|
|
15
15
|
writeBuffer(buf: Uint8Array): this;
|
|
16
16
|
concat(other: Writer): this;
|
|
17
|
-
toBuffer(): Uint8Array<ArrayBuffer> | Buffer<
|
|
17
|
+
toBuffer(): Uint8Array<ArrayBuffer> | Buffer<ArrayBuffer>;
|
|
18
18
|
reset(): this;
|
|
19
19
|
get size(): number;
|
|
20
20
|
private ensureSize;
|
package/lib/index.js
CHANGED
|
@@ -136,9 +136,8 @@ export class Writer {
|
|
|
136
136
|
return this;
|
|
137
137
|
}
|
|
138
138
|
toBuffer() {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
: this.bytes.slice(0, this.pos);
|
|
139
|
+
const view = this.bytes.subarray(0, this.pos);
|
|
140
|
+
return typeof Buffer !== "undefined" ? Buffer.from(view) : view.slice();
|
|
142
141
|
}
|
|
143
142
|
reset() {
|
|
144
143
|
this.pos = 0;
|