Skip to content

Commit 9dcada3

Browse files
use isBsonType
1 parent 0f78bf1 commit 9dcada3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/cast/int32.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
const isBsonType = require('../helpers/isBsonType');
34
const assert = require('assert');
45

56
/**
@@ -20,7 +21,7 @@ module.exports = function castInt32(val) {
2021
return null;
2122
}
2223

23-
const coercedVal = val._bsontype === 'Long' ? val.toNumber() : Number(val);
24+
const coercedVal = isBsonType(val, 'Long') ? val.toNumber() : Number(val);
2425

2526
const INT32_MAX = 0x7FFFFFFF;
2627
const INT32_MIN = -0x80000000;

0 commit comments

Comments
 (0)