uniqBy (dependentKey, propertyKey) Ember.ComputedProperty
public
A computed property which returns a new array with all the unique elements from an array, with uniqueness determined by specific key.
Example
1 2 3 4 5 6 7 8 9 10 11 12 | let Hamster = Ember.Object.extend({ uniqueFruits: Ember.computed.uniqBy( 'fruits' , 'id' ) }); let hamster = Hamster.create({ fruits: [ { id: 1, 'banana' }, { id: 2, 'grape' }, { id: 3, 'peach' }, { id: 1, 'banana' } ] }); hamster.get( 'uniqueFruits' ); // [ { id: 1, 'banana' }, { id: 2, 'grape' }, { id: 3, 'peach' }] |
Parameters:
-
dependentKey
String
-
propertyKey
String
Returns:
-
Ember.ComputedProperty
- computes a new array with all the unique elements from the dependent array
Please login to continue.