bson 5.0.1 → 5.1.0
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/lib/bson.bundle.js +10 -0
- package/lib/bson.bundle.js.map +1 -1
- package/lib/bson.cjs +10 -0
- package/lib/bson.cjs.map +1 -1
- package/lib/bson.mjs +10 -0
- package/lib/bson.mjs.map +1 -1
- package/package.json +1 -1
- package/src/extended_json.ts +13 -1
package/lib/bson.mjs
CHANGED
|
@@ -3785,6 +3785,16 @@ function getISOString(date) {
|
|
|
3785
3785
|
return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';
|
|
3786
3786
|
}
|
|
3787
3787
|
function serializeValue(value, options) {
|
|
3788
|
+
if (value instanceof Map || isMap(value)) {
|
|
3789
|
+
const obj = Object.create(null);
|
|
3790
|
+
for (const [k, v] of value) {
|
|
3791
|
+
if (typeof k !== 'string') {
|
|
3792
|
+
throw new BSONError('Can only serialize maps with string keys');
|
|
3793
|
+
}
|
|
3794
|
+
obj[k] = v;
|
|
3795
|
+
}
|
|
3796
|
+
return serializeValue(obj, options);
|
|
3797
|
+
}
|
|
3788
3798
|
if ((typeof value === 'object' || typeof value === 'function') && value !== null) {
|
|
3789
3799
|
const index = options.seenObjects.findIndex(entry => entry.obj === value);
|
|
3790
3800
|
if (index !== -1) {
|