Source: node_modules/bson/lib/bson/symbol.js

  1. 'use strict';
  2. /**
  3. * A class representation of the BSON Symbol type.
  4. *
  5. * @class
  6. * @deprecated
  7. * @param {string} value the string representing the symbol.
  8. * @return {Symbol}
  9. */
  10. function Symbol(value) {
  11. if (!(this instanceof Symbol)) return new Symbol(value);
  12. this._bsontype = 'Symbol';
  13. this.value = value;
  14. }
  15. /**
  16. * Access the wrapped string value.
  17. *
  18. * @method
  19. * @return {String} returns the wrapped string.
  20. */
  21. Symbol.prototype.valueOf = function() {
  22. return this.value;
  23. };
  24. /**
  25. * @ignore
  26. */
  27. Symbol.prototype.toString = function() {
  28. return this.value;
  29. };
  30. /**
  31. * @ignore
  32. */
  33. Symbol.prototype.inspect = function() {
  34. return this.value;
  35. };
  36. /**
  37. * @ignore
  38. */
  39. Symbol.prototype.toJSON = function() {
  40. return this.value;
  41. };
  42. module.exports = Symbol;
  43. module.exports.Symbol = Symbol;