-
-
Notifications
You must be signed in to change notification settings - Fork 406
Closed
Description
The most common long-form computed property in our project are simple checks to see if some array contains a string.
Would you be open to adding this functionality as a computed property?
// wasteful
hasBanana: function() {
return this.get('possessions').includes('banana');
}.property('possessions', 'banana'),
// wonderful
hasBanana: Ember.computed.includes('possessions', 'banana'),
// usage
let hamster = Hamster.create();
hamster.get('hasBanana'); // false
hamster.set('possessions', ['orange']);
hamster.get('hasBanana'); // false
hamster.set('possessions', ['banana']);
hamster.get('hasBanana'); // trueNo RFC yet, just want to get initial reactions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels