bson 6.10.1 → 6.10.3
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 +22 -11
- package/lib/bson.bundle.js.map +1 -1
- package/lib/bson.cjs +22 -11
- package/lib/bson.cjs.map +1 -1
- package/lib/bson.mjs +22 -11
- package/lib/bson.mjs.map +1 -1
- package/lib/bson.rn.cjs +18 -5
- package/lib/bson.rn.cjs.map +1 -1
- package/package.json +3 -3
- package/src/parser/calculate_size.ts +8 -1
- package/src/parser/serializer.ts +2 -2
- package/src/utils/number_utils.ts +17 -8
package/lib/bson.rn.cjs
CHANGED
|
@@ -495,9 +495,15 @@ const NumberUtils = {
|
|
|
495
495
|
source[offset] * 16777216);
|
|
496
496
|
},
|
|
497
497
|
getBigInt64LE(source, offset) {
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
498
|
+
const hi = BigInt(source[offset + 4] +
|
|
499
|
+
source[offset + 5] * 256 +
|
|
500
|
+
source[offset + 6] * 65536 +
|
|
501
|
+
(source[offset + 7] << 24));
|
|
502
|
+
const lo = BigInt(source[offset] +
|
|
503
|
+
source[offset + 1] * 256 +
|
|
504
|
+
source[offset + 2] * 65536 +
|
|
505
|
+
source[offset + 3] * 16777216);
|
|
506
|
+
return (hi << BigInt(32)) + lo;
|
|
501
507
|
},
|
|
502
508
|
getFloat64LE: isBigEndian
|
|
503
509
|
? (source, offset) => {
|
|
@@ -2847,6 +2853,13 @@ function calculateElement(name, value, serializeFunctions = false, isArray = fal
|
|
|
2847
2853
|
ByteUtils.utf8ByteLength(value.toString()) +
|
|
2848
2854
|
1);
|
|
2849
2855
|
}
|
|
2856
|
+
return 0;
|
|
2857
|
+
case 'bigint':
|
|
2858
|
+
return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
|
|
2859
|
+
case 'symbol':
|
|
2860
|
+
return 0;
|
|
2861
|
+
default:
|
|
2862
|
+
throw new BSONError(`Unrecognized JS type: ${typeof value}`);
|
|
2850
2863
|
}
|
|
2851
2864
|
return 0;
|
|
2852
2865
|
}
|
|
@@ -3856,8 +3869,8 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
|
|
|
3856
3869
|
done = !!entry.done;
|
|
3857
3870
|
if (done)
|
|
3858
3871
|
continue;
|
|
3859
|
-
const key = entry.value[0];
|
|
3860
|
-
let value = entry.value[1];
|
|
3872
|
+
const key = entry.value ? entry.value[0] : undefined;
|
|
3873
|
+
let value = entry.value ? entry.value[1] : undefined;
|
|
3861
3874
|
if (typeof value?.toBSON === 'function') {
|
|
3862
3875
|
value = value.toBSON();
|
|
3863
3876
|
}
|