| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3142508 commit dd8a349
16 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,8 +40,6 @@ function Binary(buffer, subType) { | |||
| 40 | 40 | throw new Error('only String, Buffer, Uint8Array or Array accepted'); | |
| 41 | 41 | } | |
| 42 | 42 | ||
| 43 | - this._bsontype = 'Binary'; | ||
| 44 | - | ||
| 45 | 43 | if (buffer instanceof Number) { | |
| 46 | 44 | this.sub_type = buffer; | |
| 47 | 45 | this.position = 0; | |
@@ -81,6 +79,11 @@ function Binary(buffer, subType) { | |||
| 81 | 79 | } | |
| 82 | 80 | } | |
| 83 | 81 | ||
| 82 | + Object.defineProperty(Binary.prototype, '_bsontype', { | ||
| 83 | + value: 'Binary', | ||
| 84 | + writable: false | ||
| 85 | + }); | ||
| 86 | + | ||
| 84 | 87 | /** | |
| 85 | 88 | * Updates this binary with byte_value. | |
| 86 | 89 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,11 +8,15 @@ | |||
| 8 | 8 | */ | |
| 9 | 9 | var Code = function Code(code, scope) { | |
| 10 | 10 | if (!(this instanceof Code)) return new Code(code, scope); | |
| 11 | - this._bsontype = 'Code'; | ||
| 12 | 11 | this.code = code; | |
| 13 | 12 | this.scope = scope; | |
| 14 | 13 | }; | |
| 15 | 14 | ||
| 15 | + Object.defineProperty(Code.prototype, '_bsontype', { | ||
| 16 | + value: 'Code', | ||
| 17 | + writable: false | ||
| 18 | + }); | ||
| 19 | + | ||
| 16 | 20 | /** | |
| 17 | 21 | * @ignore | |
| 18 | 22 | */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,12 +10,16 @@ | |||
| 10 | 10 | function DBRef(namespace, oid, db) { | |
| 11 | 11 | if (!(this instanceof DBRef)) return new DBRef(namespace, oid, db); | |
| 12 | 12 | ||
| 13 | - this._bsontype = 'DBRef'; | ||
| 14 | 13 | this.namespace = namespace; | |
| 15 | 14 | this.oid = oid; | |
| 16 | 15 | this.db = db; | |
| 17 | 16 | } | |
| 18 | 17 | ||
| 18 | + Object.defineProperty(DBRef.prototype, '_bsontype', { | ||
| 19 | + value: 'DBRef', | ||
| 20 | + writable: false | ||
| 21 | + }); | ||
| 22 | + | ||
| 19 | 23 | /** | |
| 20 | 24 | * @ignore | |
| 21 | 25 | * @api private | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -181,10 +181,14 @@ var lessThan = function(left, right) { | |||
| 181 | 181 | * @return {Double} | |
| 182 | 182 | */ | |
| 183 | 183 | var Decimal128 = function(bytes) { | |
| 184 | - this._bsontype = 'Decimal128'; | ||
| 185 | 184 | this.bytes = bytes; | |
| 186 | 185 | }; | |
| 187 | 186 | ||
| 187 | + Object.defineProperty(Decimal128.prototype, '_bsontype', { | ||
| 188 | + value: 'Decimal128', | ||
| 189 | + writable: false | ||
| 190 | + }); | ||
| 191 | + | ||
| 188 | 192 | /** | |
| 189 | 193 | * Create a Decimal128 instance from a string representation | |
| 190 | 194 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,10 +8,14 @@ | |||
| 8 | 8 | function Double(value) { | |
| 9 | 9 | if (!(this instanceof Double)) return new Double(value); | |
| 10 | 10 | ||
| 11 | - this._bsontype = 'Double'; | ||
| 12 | 11 | this.value = value; | |
| 13 | 12 | } | |
| 14 | 13 | ||
| 14 | + Object.defineProperty(Double.prototype, '_bsontype', { | ||
| 15 | + value: 'Double', | ||
| 16 | + writable: false | ||
| 17 | + }); | ||
| 18 | + | ||
| 15 | 19 | /** | |
| 16 | 20 | * Access the number value. | |
| 17 | 21 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,10 +8,14 @@ | |||
| 8 | 8 | var Int32 = function(value) { | |
| 9 | 9 | if (!(this instanceof Int32)) return new Int32(value); | |
| 10 | 10 | ||
| 11 | - this._bsontype = 'Int32'; | ||
| 12 | 11 | this.value = value; | |
| 13 | 12 | }; | |
| 14 | 13 | ||
| 14 | + Object.defineProperty(Int32.prototype, '_bsontype', { | ||
| 15 | + value: 'Int32', | ||
| 16 | + writable: false | ||
| 17 | + }); | ||
| 18 | + | ||
| 15 | 19 | /** | |
| 16 | 20 | * Access the number value. | |
| 17 | 21 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,7 +43,6 @@ | |||
| 43 | 43 | function Long(low, high) { | |
| 44 | 44 | if (!(this instanceof Long)) return new Long(low, high); | |
| 45 | 45 | ||
| 46 | - this._bsontype = 'Long'; | ||
| 47 | 46 | /** | |
| 48 | 47 | * @type {number} | |
| 49 | 48 | * @ignore | |
@@ -57,6 +56,11 @@ function Long(low, high) { | |||
| 57 | 56 | this.high_ = high | 0; // force into 32 signed bits. | |
| 58 | 57 | } | |
| 59 | 58 | ||
| 59 | + Object.defineProperty(Long.prototype, '_bsontype', { | ||
| 60 | + value: 'Long', | ||
| 61 | + writable: false | ||
| 62 | + }); | ||
| 63 | + | ||
| 60 | 64 | /** | |
| 61 | 65 | * Return the int value. | |
| 62 | 66 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,9 +6,12 @@ | |||
| 6 | 6 | */ | |
| 7 | 7 | function MaxKey() { | |
| 8 | 8 | if (!(this instanceof MaxKey)) return new MaxKey(); | |
| 9 | - | ||
| 10 | - this._bsontype = 'MaxKey'; | ||
| 11 | 9 | } | |
| 12 | 10 | ||
| 11 | + Object.defineProperty(MaxKey.prototype, '_bsontype', { | ||
| 12 | + value: 'MaxKey', | ||
| 13 | + writable: false | ||
| 14 | + }); | ||
| 15 | + | ||
| 13 | 16 | module.exports = MaxKey; | |
| 14 | 17 | module.exports.MaxKey = MaxKey; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,9 +6,12 @@ | |||
| 6 | 6 | */ | |
| 7 | 7 | function MinKey() { | |
| 8 | 8 | if (!(this instanceof MinKey)) return new MinKey(); | |
| 9 | - | ||
| 10 | - this._bsontype = 'MinKey'; | ||
| 11 | 9 | } | |
| 12 | 10 | ||
| 11 | + Object.defineProperty(MinKey.prototype, '_bsontype', { | ||
| 12 | + value: 'MinKey', | ||
| 13 | + writable: false | ||
| 14 | + }); | ||
| 15 | + | ||
| 13 | 16 | module.exports = MinKey; | |
| 14 | 17 | module.exports.MinKey = MinKey; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,8 +39,6 @@ var ObjectID = function ObjectID(id) { | |||
| 39 | 39 | if (id instanceof ObjectID) return id; | |
| 40 | 40 | if (!(this instanceof ObjectID)) return new ObjectID(id); | |
| 41 | 41 | ||
| 42 | - this._bsontype = 'ObjectID'; | ||
| 43 | - | ||
| 44 | 42 | // The most common usecase (blank id, new objectId instance) | |
| 45 | 43 | if (id == null || typeof id === 'number') { | |
| 46 | 44 | // Generate a new id | |
@@ -78,6 +76,11 @@ var ObjectID = function ObjectID(id) { | |||
| 78 | 76 | if (ObjectID.cacheHexString) this.__id = this.toString('hex'); | |
| 79 | 77 | }; | |
| 80 | 78 | ||
| 79 | + Object.defineProperty(ObjectID.prototype, '_bsontype', { | ||
| 80 | + value: 'ObjectID', | ||
| 81 | + writable: false | ||
| 82 | + }); | ||
| 83 | + | ||
| 81 | 84 | // Allow usage of ObjectId as well as ObjectID | |
| 82 | 85 | // var ObjectId = ObjectID; | |
| 83 | 86 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments