You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
910 B
JavaScript
51 lines
910 B
JavaScript
// Custom inspect property name / symbol.
|
|
var inspect = Buffer ? require('util').inspect.custom || 'inspect' : 'inspect';
|
|
|
|
/**
|
|
* A class representation of the BSON Symbol type.
|
|
*
|
|
* @class
|
|
* @deprecated
|
|
* @param {string} value the string representing the symbol.
|
|
* @return {Symbol}
|
|
*/
|
|
function Symbol(value) {
|
|
if (!(this instanceof Symbol)) return new Symbol(value);
|
|
this._bsontype = 'Symbol';
|
|
this.value = value;
|
|
}
|
|
|
|
/**
|
|
* Access the wrapped string value.
|
|
*
|
|
* @method
|
|
* @return {String} returns the wrapped string.
|
|
*/
|
|
Symbol.prototype.valueOf = function() {
|
|
return this.value;
|
|
};
|
|
|
|
/**
|
|
* @ignore
|
|
*/
|
|
Symbol.prototype.toString = function() {
|
|
return this.value;
|
|
};
|
|
|
|
/**
|
|
* @ignore
|
|
*/
|
|
Symbol.prototype[inspect] = function() {
|
|
return this.value;
|
|
};
|
|
|
|
/**
|
|
* @ignore
|
|
*/
|
|
Symbol.prototype.toJSON = function() {
|
|
return this.value;
|
|
};
|
|
|
|
module.exports = Symbol;
|
|
module.exports.Symbol = Symbol;
|