On composition and currying in JavaScript

Functional Composition, starting à la carte. Composition is a core concept of functional programming. Wikipedia defines function composition as follows: In computer science, function composition (not »

Homemade Curry

Lots of "functional programming utility libraries" (LoDash, Ramda, et. all) have a curry method. curry is quite powerful, as it allows you to build out a »

RegExp.prototype.exec() adds extra properties to return

When implementing a router, I ran into an interesting issue regarding RegExp.prototype.exec(). Let's look at an example. var regexp = /\/foo\/bar/; var match = regexp. »

Array.reduce to populate an object

An easy way to populate an object from a collection is to use reduce: var collection = [{id: 1, value: 'foo'}, {id: 2, value: 'bar'}]; var result »

The difference between partial application and currying

Partial application and currying are often confused, but are in fact quite different. Let's use lodash to illustrate the difference between partial application and currying. function »

JavaScript and this

this can be tricky in JavaScript. Coming from an OOP based language, users may expect this to always refer to it's enclosing function and be suprised »