Functional JS - Sum Types In JavaScript