symbol.js
1.43 KB
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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BSONSymbol = void 0;
/**
* A class representation of the BSON Symbol type.
* @public
* @category BSONType
*/
var BSONSymbol = /** @class */ (function () {
/**
* @param value - the string representing the symbol.
*/
function BSONSymbol(value) {
if (!(this instanceof BSONSymbol))
return new BSONSymbol(value);
this.value = value;
}
/** Access the wrapped string value. */
BSONSymbol.prototype.valueOf = function () {
return this.value;
};
BSONSymbol.prototype.toString = function () {
return this.value;
};
/** @internal */
BSONSymbol.prototype.inspect = function () {
return "new BSONSymbol(\"" + this.value + "\")";
};
BSONSymbol.prototype.toJSON = function () {
return this.value;
};
/** @internal */
BSONSymbol.prototype.toExtendedJSON = function () {
return { $symbol: this.value };
};
/** @internal */
BSONSymbol.fromExtendedJSON = function (doc) {
return new BSONSymbol(doc.$symbol);
};
/** @internal */
BSONSymbol.prototype[Symbol.for('nodejs.util.inspect.custom')] = function () {
return this.inspect();
};
return BSONSymbol;
}());
exports.BSONSymbol = BSONSymbol;
Object.defineProperty(BSONSymbol.prototype, '_bsontype', { value: 'Symbol' });
//# sourceMappingURL=symbol.js.map