Function

Module: @ember/object
import { filterBy } from '@ember/object/computed';
dependentKey
String
propertyKey
String
value
*
returns
Ember.ComputedProperty
the filtered array

Filters the array by the property and value

1
2
3
4
5
6
7
8
9
10
11
12
13
let Hamster = Ember.Object.extend({
  remainingChores: Ember.computed.filterBy('chores', 'done', false)
});

let hamster = Hamster.create({
  chores: [
    { name: 'cook', done: true },
    { name: 'clean', done: true },
    { name: 'write more unit tests', done: false }
  ]
});

hamster.get('remainingChores'); // [{ name: 'write more unit tests', done: false }]