bson 6.10.2 → 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.rn.cjs CHANGED
@@ -495,9 +495,15 @@ const NumberUtils = {
495
495
  source[offset] * 16777216);
496
496
  },
497
497
  getBigInt64LE(source, offset) {
498
- const lo = NumberUtils.getUint32LE(source, offset);
499
- const hi = NumberUtils.getUint32LE(source, offset + 4);
500
- return (BigInt(hi) << BigInt(32)) + BigInt(lo);
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) => {
@@ -3863,8 +3869,8 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
3863
3869
  done = !!entry.done;
3864
3870
  if (done)
3865
3871
  continue;
3866
- const key = entry.value[0];
3867
- let value = entry.value[1];
3872
+ const key = entry.value ? entry.value[0] : undefined;
3873
+ let value = entry.value ? entry.value[1] : undefined;
3868
3874
  if (typeof value?.toBSON === 'function') {
3869
3875
  value = value.toBSON();
3870
3876
  }