msgpackr 1.11.6 → 1.11.7
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/dist/index-no-eval.cjs +7 -4
- package/dist/index-no-eval.cjs.map +1 -1
- package/dist/index-no-eval.min.js +1 -1
- package/dist/index-no-eval.min.js.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/node.cjs +7 -4
- package/dist/node.cjs.map +1 -1
- package/dist/test.js +7 -4
- package/dist/test.js.map +1 -1
- package/pack.js +7 -4
- package/package.json +1 -1
package/dist/node.cjs
CHANGED
|
@@ -1343,10 +1343,13 @@ class Packr extends Unpackr {
|
|
|
1343
1343
|
hasSharedUpdate = false;
|
|
1344
1344
|
let encodingError;
|
|
1345
1345
|
try {
|
|
1346
|
-
if (packr.randomAccessStructure && value && value.constructor
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1346
|
+
if (packr.randomAccessStructure && value && value.constructor) {
|
|
1347
|
+
if (value.constructor === Object) writeStruct(value); // simple object
|
|
1348
|
+
else if (value.constructor !== Map && !Array.isArray(value) && !extensionClasses.some(extClass => value instanceof extClass)) {
|
|
1349
|
+
// allow user classes, if they don't need special handling (but do use toJSON if available)
|
|
1350
|
+
writeStruct(value.toJSON ? value.toJSON() : value);
|
|
1351
|
+
} else pack(value);
|
|
1352
|
+
} else
|
|
1350
1353
|
pack(value);
|
|
1351
1354
|
let lastBundle = bundledStrings;
|
|
1352
1355
|
if (bundledStrings)
|