symbol.js 781 B

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