msgpackr 1.7.0-alpha7 → 1.7.0-beta1

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/README.md CHANGED
@@ -40,7 +40,7 @@ stream.write(myData);
40
40
  ```
41
41
  Or for a full example of sending and receiving data on a stream:
42
42
  ```js
43
- import { PackrStream } from 'msgpackr';
43
+ import { PackrStream, UnpackrStream } from 'msgpackr';
44
44
  let sendingStream = new PackrStream();
45
45
  let receivingStream = new UnpackrStream();
46
46
  // we are just piping to our own stream, but normally you would send and
package/dist/index.js CHANGED
@@ -875,7 +875,16 @@
875
875
 
876
876
  // the registration of the record definition extension (as "r")
877
877
  const recordDefinition = (id, highByte) => {
878
- var structure = read();
878
+ let structure;
879
+ if (currentUnpackr.freezeData) {
880
+ currentUnpackr.freezeData = false;
881
+ try {
882
+ structure = read();
883
+ } finally {
884
+ currentUnpackr.freezeData = true;
885
+ }
886
+ } else
887
+ structure = read();
879
888
  let firstByte = id;
880
889
  if (highByte !== undefined) {
881
890
  id = id < 32 ? -((highByte << 5) + id) : ((highByte << 5) + id);