Skip to content

Commit

Permalink
refactor(serialization): revert optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Mar 12, 2018
1 parent e04ee15 commit b9384e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/bson/bson.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ BSON.prototype.serialize = function serialize(object, options) {
typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
var minInternalBufferSize =
typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE;

// Resize the internal serialization buffer if needed
if (buffer.length < minInternalBufferSize) {
buffer = new Buffer(minInternalBufferSize);
Expand Down Expand Up @@ -102,14 +102,15 @@ BSON.prototype.serializeWithBufferAndIndex = function(object, finalBuffer, optio

// Attempt to serialize
var serializationIndex = serializer(
finalBuffer,
buffer,
object,
checkKeys,
0,
0,
serializeFunctions,
ignoreUndefined
);
buffer.copy(finalBuffer, startIndex, 0, serializationIndex);

// Return the index
return startIndex + serializationIndex - 1;
Expand Down

0 comments on commit b9384e2

Please sign in to comment.