This repository has been archived on 2024-09-11. You can view files and clone it, but cannot push or open issues or pull requests.
svrjs-blog-newsletter/backend/node_modules/bson/lib/symbol.js
2024-05-26 22:54:55 +02:00

48 lines
No EOL
1.4 KiB
JavaScript

"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(\"".concat(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