cbor-x 1.5.3 → 1.5.4
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 +8 -1
- 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 +8 -1
- 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 +8 -1
- package/dist/node.cjs.map +1 -1
- package/encode.js +8 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index-no-eval.cjs
CHANGED
|
@@ -1654,6 +1654,13 @@
|
|
|
1654
1654
|
error.iteratorNotHandled = true;
|
|
1655
1655
|
throw error;
|
|
1656
1656
|
}
|
|
1657
|
+
if (this.useToJSON && value.toJSON) {
|
|
1658
|
+
const json = value.toJSON();
|
|
1659
|
+
// if for some reason value.toJSON returns itself it'll loop forever
|
|
1660
|
+
if (json !== value)
|
|
1661
|
+
return encode(json)
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1657
1664
|
// no extension found, write as object
|
|
1658
1665
|
writeObject(value, !value.hasOwnProperty); // if it doesn't have hasOwnProperty, don't do hasOwnProperty checks
|
|
1659
1666
|
}
|
|
@@ -1707,7 +1714,7 @@
|
|
|
1707
1714
|
}
|
|
1708
1715
|
if (encoder.keyMap) {
|
|
1709
1716
|
for (let i = 0; i < length; i++) {
|
|
1710
|
-
encode(encodeKey(keys[i]));
|
|
1717
|
+
encode(encoder.encodeKey(keys[i]));
|
|
1711
1718
|
encode(vals[i]);
|
|
1712
1719
|
}
|
|
1713
1720
|
} else {
|