Pattern matching on named properties, refactoring