Advertisement
lubaochuan

Untitled

Aug 19th, 2020
1,075
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. let Identity = function(value) {
  3.   this._val = value
  4. };
  5.  
  6. Identity.from = function(value) {
  7.   return new Identity(value)
  8. };
  9.  
  10. Identity.prototype.get = function() {
  11.   return this._val
  12. };
  13.  
  14. Identity.prototype.toString = function() {
  15.   return `Identity<${JSON.stringify(this.get())}>`;
  16. };
  17.  
  18. let Failure = function(value) {
  19.   this._val = value
  20. };
  21.  
  22. Failure.from = function(value) {
  23.   return new Failure(value)
  24. };
  25.  
  26. Failure.prototype.get = function() {
  27.   return this._val
  28. };
  29.  
  30. Failure.prototype.toString = function() {
  31.   return `Failure<${JSON.stringify(this.get())}>`;
  32. };
  33.  
  34. export {Identity, Failure};
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement