Function
intersect (propertyKey) Ember.ComputedProperty public
Module: | @ember/object |
---|
Defined in packages/ember-runtime/lib/computed/reduce_computed_macros.js:521
import { intersect } from '@ember/object/computed';
- propertyKey
- String
- returns
- Ember.ComputedProperty
- computes a new array with all the duplicated elements from the dependent arrays
A computed property which returns a new array with all the elements two or more dependent arrays have in common.
Example
let obj = Ember.Object.extend({ friendsInCommon: Ember.computed.intersect('adaFriends', 'charlesFriends') }).create({ adaFriends: ['Charles Babbage', 'John Hobhouse', 'William King', 'Mary Somerville'], charlesFriends: ['William King', 'Mary Somerville', 'Ada Lovelace', 'George Peacock'] }); obj.get('friendsInCommon'); // ['William King', 'Mary Somerville']
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/2.18/functions/@ember%2Fobject%2Fcomputed/intersect