Functional Programming, JavaScript.
Option(val)); }, ofNullable: function (val) { var inst = val !== null ? this.of(val) : this.empty(); return Object.freeze(inst); } } })(); There are many ways of doing this, I like the notion of immutability in objects, which is why I choose to freeze objects as they are created. Using Optional we