File tree 10 files changed +13
-21
lines changed
10 files changed +13
-21
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ class Binary {
30
30
throw new Error ( 'only String, Buffer, Uint8Array or Array accepted' ) ;
31
31
}
32
32
33
- this . _bsontype = 'Binary' ;
34
-
35
33
if ( buffer instanceof Number ) {
36
34
this . sub_type = buffer ;
37
35
this . position = 0 ;
@@ -375,7 +373,5 @@ Binary.SUBTYPE_MD5 = 5;
375
373
**/
376
374
Binary . SUBTYPE_USER_DEFINED = 128 ;
377
375
378
- /**
379
- * Expose.
380
- */
376
+ Object . defineProperty ( Binary . prototype , '_bsontype' , { value : 'Binary' } ) ;
381
377
module . exports = Binary ;
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ class Code {
12
12
* @return {Code }
13
13
*/
14
14
constructor ( code , scope ) {
15
- this . _bsontype = 'Code' ;
16
15
this . code = code ;
17
16
this . scope = scope ;
18
17
}
@@ -25,4 +24,5 @@ class Code {
25
24
}
26
25
}
27
26
27
+ Object . defineProperty ( Code . prototype , '_bsontype' , { value : 'Code' } ) ;
28
28
module . exports = Code ;
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
+
2
3
/**
3
4
* A class representation of the BSON DBRef type.
4
5
*/
@@ -19,7 +20,6 @@ class DBRef {
19
20
collection = parts . shift ( ) ;
20
21
}
21
22
22
- this . _bsontype = 'DBRef' ;
23
23
this . collection = collection ;
24
24
this . oid = oid ;
25
25
this . db = db ;
@@ -44,4 +44,5 @@ class DBRef {
44
44
}
45
45
}
46
46
47
+ Object . defineProperty ( DBRef . prototype , '_bsontype' , { value : 'DBRef' } ) ;
47
48
module . exports = DBRef ;
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ class Double {
10
10
* @return {Double }
11
11
*/
12
12
constructor ( value ) {
13
- this . _bsontype = 'Double' ;
14
13
this . value = value ;
15
14
}
16
15
@@ -32,4 +31,5 @@ class Double {
32
31
}
33
32
}
34
33
34
+ Object . defineProperty ( Double . prototype , '_bsontype' , { value : 'Double' } ) ;
35
35
module . exports = Double ;
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ class Int32 {
10
10
* @return {Int32 }
11
11
*/
12
12
constructor ( value ) {
13
- this . _bsontype = 'Int32' ;
14
13
this . value = value ;
15
14
}
16
15
@@ -32,4 +31,5 @@ class Int32 {
32
31
}
33
32
}
34
33
34
+ Object . defineProperty ( Int32 . prototype , '_bsontype' , { value : 'Int32' } ) ;
35
35
module . exports = Int32 ;
Original file line number Diff line number Diff line change @@ -8,9 +8,8 @@ class MaxKey {
8
8
*
9
9
* @return {MaxKey } A MaxKey instance
10
10
*/
11
- constructor ( ) {
12
- this . _bsontype = 'MaxKey' ;
13
- }
11
+ constructor ( ) { }
14
12
}
15
13
14
+ Object . defineProperty ( MaxKey . prototype , '_bsontype' , { value : 'MaxKey' } ) ;
16
15
module . exports = MaxKey ;
Original file line number Diff line number Diff line change @@ -8,9 +8,8 @@ class MinKey {
8
8
*
9
9
* @return {MinKey } A MinKey instance
10
10
*/
11
- constructor ( ) {
12
- this . _bsontype = 'MinKey' ;
13
- }
11
+ constructor ( ) { }
14
12
}
15
13
14
+ Object . defineProperty ( MinKey . prototype , '_bsontype' , { value : 'MinKey' } ) ;
16
15
module . exports = MinKey ;
Original file line number Diff line number Diff line change @@ -53,7 +53,6 @@ class ObjectID {
53
53
constructor ( id ) {
54
54
// Duck-typing to support ObjectId from different npm packages
55
55
if ( id instanceof ObjectID ) return id ;
56
- this . _bsontype = 'ObjectID' ;
57
56
58
57
// The most common usecase (blank id, new objectId instance)
59
58
if ( id == null || typeof id === 'number' ) {
@@ -381,7 +380,5 @@ ObjectID.prototype.inspect = ObjectID.prototype.toString;
381
380
*/
382
381
ObjectID . index = ~ ~ ( Math . random ( ) * 0xffffff ) ;
383
382
384
- /**
385
- * Expose.
386
- */
383
+ Object . defineProperty ( ObjectID . prototype , '_bsontype' , { value : 'ObjectID' } ) ;
387
384
module . exports = ObjectID ;
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ class BSONRegExp {
19
19
*/
20
20
constructor ( pattern , options ) {
21
21
// Execute
22
- this . _bsontype = 'BSONRegExp' ;
23
22
this . pattern = pattern || '' ;
24
23
this . options = options ? alphabetize ( options ) : '' ;
25
24
@@ -41,4 +40,5 @@ class BSONRegExp {
41
40
}
42
41
}
43
42
43
+ Object . defineProperty ( BSONRegExp . prototype , '_bsontype' , { value : 'BSONRegExp' } ) ;
44
44
module . exports = BSONRegExp ;
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ class Symbol {
9
9
* @param {string } value the string representing the symbol.
10
10
*/
11
11
constructor ( value ) {
12
- this . _bsontype = 'Symbol' ;
13
12
this . value = value ;
14
13
}
15
14
@@ -45,4 +44,5 @@ class Symbol {
45
44
}
46
45
}
47
46
47
+ Object . defineProperty ( Symbol . prototype , '_bsontype' , { value : 'Symbol' } ) ;
48
48
module . exports = Symbol ;
You can’t perform that action at this time.
0 commit comments