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/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "vendor"
15
15
  ],
16
16
  "types": "bson.d.ts",
17
- "version": "6.10.2",
17
+ "version": "6.10.3",
18
18
  "author": {
19
19
  "name": "The MongoDB NodeJS Team",
20
20
  "email": "dbx-node@mongodb.com"
@@ -45,7 +45,7 @@
45
45
  "eslint-config-prettier": "^9.1.0",
46
46
  "eslint-plugin-no-bigint-usage": "file:etc/eslint/no-bigint-usage",
47
47
  "eslint-plugin-prettier": "^5.2.1",
48
- "eslint-plugin-tsdoc": "^0.3.0",
48
+ "eslint-plugin-tsdoc": "^0.4.0",
49
49
  "magic-string": "^0.30.11",
50
50
  "mocha": "^10.7.0",
51
51
  "node-fetch": "^3.3.2",
@@ -111,7 +111,7 @@
111
111
  "build:bundle": "rollup -c rollup.config.mjs",
112
112
  "build": "npm run build:dts && npm run build:bundle",
113
113
  "check:lint": "ESLINT_USE_FLAT_CONFIG=false eslint -v && ESLINT_USE_FLAT_CONFIG=false eslint --ext '.js,.ts' --max-warnings=0 src test && npm run build:dts && npm run check:tsd",
114
- "format": "eslint --ext '.js,.ts' src test --fix",
114
+ "format": "ESLINT_USE_FLAT_CONFIG=false eslint --ext '.js,.ts' src test --fix",
115
115
  "check:coverage": "nyc --check-coverage npm run check:node",
116
116
  "prepare": "node etc/prepare.js",
117
117
  "release": "standard-version -i HISTORY.md"
@@ -726,8 +726,8 @@ export function serializeInto(
726
726
  if (done) continue;
727
727
 
728
728
  // Get the entry values
729
- const key = entry.value[0];
730
- let value = entry.value[1];
729
+ const key = entry.value ? entry.value[0] : undefined;
730
+ let value = entry.value ? entry.value[1] : undefined;
731
731
 
732
732
  if (typeof value?.toBSON === 'function') {
733
733
  value = value.toBSON();
@@ -83,14 +83,23 @@ export const NumberUtils: NumberUtils = {
83
83
 
84
84
  /** Reads a little-endian 64-bit integer from source */
85
85
  getBigInt64LE(source: Uint8Array, offset: number): bigint {
86
- const lo = NumberUtils.getUint32LE(source, offset);
87
- const hi = NumberUtils.getUint32LE(source, offset + 4);
88
-
89
- /*
90
- eslint-disable-next-line no-restricted-globals
91
- -- This is allowed since this helper should not be called unless bigint features are enabled
92
- */
93
- return (BigInt(hi) << BigInt(32)) + BigInt(lo);
86
+ // eslint-disable-next-line no-restricted-globals
87
+ const hi = BigInt(
88
+ source[offset + 4] +
89
+ source[offset + 5] * 256 +
90
+ source[offset + 6] * 65536 +
91
+ (source[offset + 7] << 24)
92
+ ); // Overflow
93
+
94
+ // eslint-disable-next-line no-restricted-globals
95
+ const lo = BigInt(
96
+ source[offset] +
97
+ source[offset + 1] * 256 +
98
+ source[offset + 2] * 65536 +
99
+ source[offset + 3] * 16777216
100
+ );
101
+ // eslint-disable-next-line no-restricted-globals
102
+ return (hi << BigInt(32)) + lo;
94
103
  },
95
104
 
96
105
  /** Reads a little-endian 64-bit float from source */