const containsAppsMatchingSearch = (values, search) => {
  if (search.value.trim() === '') {
    return true
  }

  for (let key in values) {
    if (isAppMatchingSearch(values[key].name)) {
      return true
    }
  }

  return false
}

const isAppMatchingSearch = (item, search) => {
  if (search.trim() === '') {
    return true
  }

  return item.name.toLowerCase().includes(search.trim().toLowerCase())
}

export { containsAppsMatchingSearch, isAppMatchingSearch }
