<commit_before>(function(){
  angular.module('notely.notes.service', [])
    .service('notes', notesService);

    notesService['$inject'] = ['$http'];
    function notesService($http){
      var notes = [];
      var nevernoteBasePath = 'https://nevernote-1150.herokuapp.com/api/v1/';
      var user = {
        apiKey: <KEY>'

      }

      this.all = function(){
        return notes;
      }

      this.findById = function(noteId) {
        for (var i = 0, len = notes.length; i < len; i++) {
            //notes[notes[i].noteId] = array[i];
            //
            if(notes[i].id.toString === noteId) {
              return notes[i];
            }
        }

        return {};
      }

      this.fetchNotes = function(callback){

        $http.get(nevernoteBasePath + 'notes?api_key=' + user.apiKey)
          .success(function(notesData){
            notes = notesData;

            if(callback) {
              callback(notes);
            }

          });

        return notes;

      };


    }


})();
<commit_msg>change findby id to angulars filter<commit_after>(function(){
  angular.module('notely.notes.service', [])
    .service('notes', notesService);

    notesService['$inject'] = ['$http', '$filter'];
    function notesService($http, $filter){
      var notes = [];
      var nevernoteBasePath = 'https://nevernote-1150.herokuapp.com/api/v1/';
      var user = {
        apiKey: <KEY>'

      }

      this.all = function(){
        return notes;
      }

      this.findById = function(noteId) {
        return ($filter('filter')(notes, { id: parseInt(noteId) }, true)[0] || {});
      }

      this.fetchNotes = function(callback){

        $http.get(nevernoteBasePath + 'notes?api_key=' + user.apiKey)
          .success(function(notesData){
            notes = notesData;

            if(callback) {
              callback(notes);
            }

          });

        return notes;

      };


    }


})();

{'fraction_non_alphanumeric': 0.15971148892323545, 'fraction_numerical': 0.0061823802163833074, 'mean_word_length': 1.826783114992722, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '4907352', 'n_tokens_mistral': 606, 'n_tokens_neox': 572, 'n_words': 98}