functional pattern match syntax for JavaScript switch-case statement