46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.BSONSymbol = void 0;
|
|
/**
|
|
* A class representation of the BSON Symbol type.
|
|
* @public
|
|
*/
|
|
class BSONSymbol {
|
|
/**
|
|
* @param value - the string representing the symbol.
|
|
*/
|
|
constructor(value) {
|
|
this.value = value;
|
|
}
|
|
/** Access the wrapped string value. */
|
|
valueOf() {
|
|
return this.value;
|
|
}
|
|
/** @internal */
|
|
toString() {
|
|
return this.value;
|
|
}
|
|
/** @internal */
|
|
inspect() {
|
|
return `BSONSymbol("${this.value}")`;
|
|
}
|
|
/** @internal */
|
|
toJSON() {
|
|
return this.value;
|
|
}
|
|
/** @internal */
|
|
toExtendedJSON() {
|
|
return { $symbol: this.value };
|
|
}
|
|
/** @internal */
|
|
static fromExtendedJSON(doc) {
|
|
return new BSONSymbol(doc.$symbol);
|
|
}
|
|
/** @internal */
|
|
[Symbol.for('nodejs.util.inspect.custom')]() {
|
|
return this.inspect();
|
|
}
|
|
}
|
|
exports.BSONSymbol = BSONSymbol;
|
|
Object.defineProperty(BSONSymbol.prototype, '_bsontype', { value: 'Symbol' });
|
|
//# sourceMappingURL=symbol.js.map
|