mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 10:52:47 +00:00
33 lines
610 B
JavaScript
33 lines
610 B
JavaScript
/**
|
|
* A class representation of the BSON Double type.
|
|
*
|
|
* @class
|
|
* @param {number} value the number we want to represent as a double.
|
|
* @return {Double}
|
|
*/
|
|
function Double(value) {
|
|
if(!(this instanceof Double)) return new Double(value);
|
|
|
|
this._bsontype = 'Double';
|
|
this.value = value;
|
|
}
|
|
|
|
/**
|
|
* Access the number value.
|
|
*
|
|
* @method
|
|
* @return {number} returns the wrapped double number.
|
|
*/
|
|
Double.prototype.valueOf = function() {
|
|
return this.value;
|
|
};
|
|
|
|
/**
|
|
* @ignore
|
|
*/
|
|
Double.prototype.toJSON = function() {
|
|
return this.value;
|
|
}
|
|
|
|
module.exports = Double;
|
|
module.exports.Double = Double; |