addon/list-utils.js
function shouldAddCurrentValue ({items, valueRecord, labelAttribute, valueAttribute, filter}) {
  const filterRegex = new RegExp(filter, 'i')
  const valueRecordMatchesFilter = filterRegex.test(valueRecord.get(labelAttribute))
  const itemsContainsValueRecord = items.find(item => item.value === valueRecord.get(valueAttribute))
  return valueRecordMatchesFilter && !itemsContainsValueRecord
}
function shouldAddCurrentValue ({items, valueRecord, labelAttribute, valueAttribute, filter}) {
  const filterRegex = new RegExp(filter, 'i')
  const valueRecordMatchesFilter = filterRegex.test(valueRecord.get(labelAttribute))
  const itemsContainsValueRecord = items.find(item => item.value === valueRecord.get(valueAttribute))
  return valueRecordMatchesFilter && !itemsContainsValueRecord
}
function shouldAddCurrentValue ( { items , valueRecord , labelAttribute , valueAttribute , filter } ) { const filterRegex = new RegExp ( filter , 'i' ) const valueRecordMatchesFilter = filterRegex . test ( valueRecord . get ( labelAttribute ) ) const itemsContainsValueRecord = items . find ( item => item . value === valueRecord . get ( valueAttribute ) ) return valueRecordMatchesFilter && ! itemsContainsValueRecord }
Determine whether or not valueRecord should be appended to data
@param {Object[]} items - the larger set of data
@param {EmberObject} valueRecord - the record to add or not
@param {String} labelAttribute - dot notated path to label attribute in record
@param {String} valueAttribute - dot notated path to value attribute in record
@param {String} filter - the partial match query filter to populate
@returns {boolean} true if valueRecord should be added to items
Determine whether or not valueRecord should be appended to data