Also ES6 comes with includes
which will replace that ugly indexOf(str) >= 0
, supported in the most important browsers like Edge, FF>= 43, Chrome and Opera, and Node >= 4, it would look like:return this.items.filter((item) => {
return this.items.filter((item) => { if (item.id.contains(str) || item.name.contains(str) || item.position.contains(str)) { return true } return false })