Closed ASH-Michael closed 6 years ago
To reduce redundancy and reduce amount of code written.
//bad fullName: computed('user.firstName', 'user.lastName', function () { const firstName = get(this, 'user.firstName'); const lastName = get(this, 'user.lastName'); return firstName + ' ' + lastName; }) //good fullName: computed('user.{firstName,lastName}', function () { const { firstName, lastName } = get(this, 'user'); return `${firstName} ${lastName}`; })
To reduce redundancy and reduce amount of code written.