Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Commit

Permalink
feat(int32): support relaxed parsing of int32 types
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Apr 1, 2018
1 parent 0ee5016 commit c8513cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bson/int_32.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ function toExtendedJSON(obj, options) {
return { $numberInt: obj.value.toString() };
}

function fromExtendedJSON(BSON, doc) {
return new BSON.Int32(doc.$numberInt);
function fromExtendedJSON(BSON, doc, options) {
return options && options.relaxed ? parseInt(doc.$numberInt, 10) : new BSON.Int32(doc.$numberInt);
}

module.exports = {
Expand Down

0 comments on commit c8513cb

Please sign in to comment.