One of the goals of the allong.es library is to provide easy-to-use tools for writing JavaScript and CoffeeScript programs using functional composition.
To pick an example out of thin air, this snippet shows how to write a method that usesmaybe to ensure that it doesn’t do anything if you pass in null or undefined, and that uses Fluent to ensure that it always returns the receiver, jQuery-style:
User.prototype.setName = fluent( maybe( function (name) { this.name = name; }));
Your new post is loading...