Skip to content

Commit 6df9022

Browse files
committed
fix(*): make sure all functions are named consistently
In node 4.x for the bson-ext module we are not getting a valid function name for these types, and therefore the build breaks. This change ensures all functions have an accessible type name, which will additionally be useful during debugging in some cases.
1 parent 1289516 commit 6df9022

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

Diff for: lib/bson/code.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
* @param {Object} [scope] an optional scope for the function.
99
* @return {Code}
1010
*/
11-
var Code = function Code(code, scope) {
11+
function Code(code, scope) {
1212
if (!(this instanceof Code)) return new Code(code, scope);
1313
this._bsontype = 'Code';
1414
this.code = code;
1515
this.scope = scope;
16-
};
16+
}
1717

1818
/**
1919
* @ignore

Diff for: lib/bson/decimal128.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ var invalidErr = function(string, message) {
152152
* @param {Buffer} bytes a buffer containing the raw Decimal128 bytes.
153153
* @return {Double}
154154
*/
155-
var Decimal128 = function(bytes) {
155+
function Decimal128(bytes) {
156156
this._bsontype = 'Decimal128';
157157
this.bytes = bytes;
158-
};
158+
}
159159

160160
/**
161161
* Create a Decimal128 instance from a string representation

Diff for: lib/bson/int_32.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
* @param {number} value the number we want to represent as an int32.
77
* @return {Int32}
88
*/
9-
var Int32 = function(value) {
9+
function Int32(value) {
1010
if (!(this instanceof Int32)) return new Int32(value);
1111

1212
this._bsontype = 'Int32';
1313
this.value = value;
14-
};
14+
}
1515

1616
/**
1717
* Access the number value.

Diff for: lib/bson/map.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if (typeof global.Map !== 'undefined') {
66
module.exports.Map = global.Map;
77
} else {
88
// We will return a polyfill
9-
var Map = function(array) {
9+
var Map = function Map(array) {
1010
this._keys = [];
1111
this._values = {};
1212

Diff for: lib/bson/objectid.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ try {
2828
* @property {number} generationTime The generation time of this ObjectId instance
2929
* @return {ObjectID} instance of ObjectID.
3030
*/
31-
var ObjectID = function ObjectID(id) {
31+
function ObjectID(id) {
3232
// Duck-typing to support ObjectId from different npm packages
3333
if (id instanceof ObjectID) return id;
3434
if (!(this instanceof ObjectID)) return new ObjectID(id);
@@ -70,7 +70,7 @@ var ObjectID = function ObjectID(id) {
7070
}
7171

7272
if (ObjectID.cacheHexString) this.__id = this.toString('hex');
73-
};
73+
}
7474

7575
// Allow usage of ObjectId as well as ObjectID
7676
// var ObjectId = ObjectID;

Diff for: lib/bson/timestamp.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ var Long = require('./long');
88
* @param {number} high the high (signed) 32 bits of the Timestamp.
99
* @return {Timestamp}
1010
*/
11-
var Timestamp = function(low, high) {
11+
function Timestamp(low, high) {
1212
if (low instanceof Long) {
1313
Long.call(this, low.low_, low.high_);
1414
} else {
1515
Long.call(this, low, high);
1616
}
1717

1818
this._bsontype = 'Timestamp';
19-
};
19+
}
2020

2121
Timestamp.prototype = Object.create(Long.prototype);
2222
Timestamp.prototype.constructor = Timestamp;

0 commit comments

Comments
 (0)