variator
Prefix based method dispatch is an extendable alternative to imperative switch statements.
Usage
var variator = var price = priceprice // => "Total price for Oranges is $1" // => "Total price for Apples is $1.6" // Errors are thrown for unknown cases: // => TypeError: Method price#0hq76f not implemented for: Cherries // Although new cases can be definedprice // => "Total price for Cherries is $6"
Install
npm install variator