Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "preserves", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Experimental data serialization format", | ||
@@ -5,0 +5,0 @@ "homepage": "https://gitlab.com/tonyg/preserves", |
@@ -21,3 +21,5 @@ "use strict"; | ||
options = options || {}; | ||
this.packet = packet._view || packet; // strip off Bytes wrapper, if any | ||
this.packet = packet | ||
? (packet._view || packet) // strip off Bytes wrapper, if any | ||
: new Uint8Array(0); | ||
this.index = 0; | ||
@@ -27,2 +29,7 @@ this.shortForms = options.shortForms || {}; | ||
write(data) { | ||
this.packet = Bytes.concat([this.packet.slice(this.index), data])._view; | ||
this.index = 0; | ||
} | ||
nextbyte() { | ||
@@ -179,2 +186,15 @@ if (this.index >= this.packet.length) throw new ShortPacket("Short packet"); | ||
} | ||
try_next() { | ||
const start = this.index; | ||
try { | ||
return this.next(); | ||
} catch (e) { | ||
if (e instanceof ShortPacket) { | ||
this.index = start; | ||
return void 0; | ||
} | ||
throw e; | ||
} | ||
} | ||
} | ||
@@ -181,0 +201,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32354
893