bson 4.6.3 → 4.6.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/bson.esm.js CHANGED
@@ -2556,7 +2556,8 @@ var ObjectId = /** @class */ (function () {
2556
2556
  this[kId] = ObjectId.generate(typeof workingId === 'number' ? workingId : undefined);
2557
2557
  }
2558
2558
  else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
2559
- this[kId] = ensureBuffer(workingId);
2559
+ // If intstanceof matches we can escape calling ensure buffer in Node.js environments
2560
+ this[kId] = workingId instanceof Buffer ? workingId : ensureBuffer(workingId);
2560
2561
  }
2561
2562
  else if (typeof workingId === 'string') {
2562
2563
  if (workingId.length === 12) {