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.
@@ -4593,7 +4593,8 @@
4593
4593
  this[kId] = ObjectId.generate(typeof workingId === 'number' ? workingId : undefined);
4594
4594
  }
4595
4595
  else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
4596
- this[kId] = ensureBuffer(workingId);
4596
+ // If intstanceof matches we can escape calling ensure buffer in Node.js environments
4597
+ this[kId] = workingId instanceof buffer_1 ? workingId : ensureBuffer(workingId);
4597
4598
  }
4598
4599
  else if (typeof workingId === 'string') {
4599
4600
  if (workingId.length === 12) {