rwldrn/idiomatic.js — pull request #64 by nrn (2012-06-20 08:13:14+00:00)
Title: Changes to 7.A.1 switchModule

Hey everyone, I use a pattern similar to the switchModule that I like quite a bit, so I figured I'd contribute it back and see if you do too.

By treating the switchModule as a function that accepts the argument to switch on and returns the single function (or _default) you want it becomes easier to use, and less cumbersome when used with functional array methods `[1, 2, 3, 4].forEach( switchModule( foo ))` or event emitters `$('button').on('click', switchModule( foo ))`

Thanks for this great resource,

--nick