var Switch = require('switch-fn')var fn = Switch({ a: actionA, b: actionB, default: defaultAction})var result = fn('a') // => calls actionA with 'a' and gives back actionA's return value
API
Switch(cases) -> function
cases
Required
Type: object
An object, with keys being the 'cases' to match against and values being the function to call in each case.
If no case matching the input is found and a 'default' case is given, it will be used.