Native pattern matching for JavaScript