Scott Watermasysk Husband, Father, and KickoffLabs co-founder. Interests: basketball, bootstrapping, keyboards, training, and Building new things

Ruby Pattern Matching aka Almost JavaScript Destructing

Published:

One of my favorite (modern) JavaScript features is destructuring. Ruby 2.7’s pattern matching makes this almost possible, but the lack of handling missing items makes it unusable for destructuring today.

Pattern matching is clearly marked as experimental. It sounds like this more about the syntax and performance than functionality. Proper destructuring would make working with JSON (and Ruby hashes in general) more enjoyable. Hopefully this becomes an option.

See: JavaScript Destructuring.