symbol.js
910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// 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;