<commit_before>########################################################
# AngularJS service to find objects in the root scope
########################################################

angular.module('feedbunch').service 'findSvc',
['$rootScope', '$filter', ($rootScope, $filter)->

  #---------------------------------------------
  # Find a feed given its id
  #---------------------------------------------
  find_feed: (id)->
    feeds = $filter('filter') $rootScope.feeds, {id: id}
    return feeds[0]

  #---------------------------------------------
  # Find a folder given its id
  #---------------------------------------------
  find_folder: (id)->
    if id == 'none'
      return null
    else if id == "all"
      return {id: "all"}
    else
      folders = $filter('filter') $rootScope.folders, {id: id}
      return folders[0]

  #---------------------------------------------
  # Find feeds in a folder given the folder
  #---------------------------------------------
  find_folder_feeds: (folder)->
    if folder != 'all'
      return $filter('filter') $rootScope.feeds, (feed)->
        return feed.folder_id == folder.id
    else<commit_msg>Extended the change in commit <PASSWORD> to all uses of the $filter angularjs service.<commit_after>########################################################
# AngularJS service to find objects in the root scope
########################################################

angular.module('feedbunch').service 'findSvc',
['$rootScope', '$filter', ($rootScope, $filter)->

  #---------------------------------------------
  # Find a feed given its id
  #---------------------------------------------
  find_feed: (id)->
    feeds = $filter('filter') $rootScope.feeds, (feed)->
      return feed.id == id
    return feeds[0]

  #---------------------------------------------
  # Find a folder given its id
  #---------------------------------------------
  find_folder: (id)->
    if id == 'none'
      return null
    else if id == "all"
      return {id: "all"}
    else
      folders = $filter('filter') $rootScope.folders, (folder)->
        return folder.id == id
      return folders[0]

  #---------------------------------------------
  # Find feeds in a folder given the folder
  #---------------------------------------------
  find_folder_feeds: (folder)->
    if folder != 'all'
      return $filter('filter') $rootScope.feeds, (feed)->
        return feed.folder_id == folder.id
    else
{'fraction_non_alphanumeric': 0.40929474113330616, 'fraction_numerical': 0.0016306563391765185, 'mean_word_length': 1.4964394710071212, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1458208', 'n_tokens_mistral': 598, 'n_tokens_neox': 578, 'n_words': 176}