<commit_before>angular.module('pvta.factories')

.factory('FavoriteStops', function () {
  var stops = [];
  var push = function (stop) {
    localforage.getItem('favoriteStops', function (err, stops) {
      var newStop = {StopId: stop.StopId, Name: stop.Name};
      if (stops) {
        stops.push(newStop);
        localforage.setItem('favoriteStops', stops);
      }
      else {
        var favoriteStops = [newStop];
        localforage.setItem('favoriteStops', favoriteStops);
      }
    });
  };

  var getAll = function () {
    localforage.getItem('favoriteStops', function (err) {
      if (err) {
        console.log('Error getting all favorite stops: ' + err);
      }
    });
  };

  var remove = function (stop) {
    localforage.getItem('favoriteStops', function (err, stops) {
      for (var i = 0; i < stops.length; i++) {
        if (stops[i].StopId === stop.StopId) {
          stops.splice(i, 1);
        }
      }
      localforage.setItem('favoriteStops', stops, function (err) {
        if (err) {
          console.log('Error removing favorite stop: ' + err);
        }
      });
    });
  };

  function contains (stopId, cb) {
    localforage.getItem('favoriteStops', function (err, stops) {
      if (stops) {
        var r = _.where(stops, { StopId: stopId });
        if (r.length > 0) {
          cb(true);
        }
        else {
          cb(false);
        }
      }
      else {
        cb(false);
      }
    });
  }
  return {
    push: push,
    getAll: getAll,
    remove: remove,
    contains: contains
  };
});
<commit_msg>Variable renamed<commit_after>angular.module('pvta.factories')

.factory('FavoriteStops', function () {
  var stops = [];
  var push = function (stop) {
    localforage.getItem('favoriteStops', function (err, stops) {
      var newStop = {StopId: stop.StopId, Name: stop.Name};
      if (stops) {
        stops.push(newStop);
        localforage.setItem('favoriteStops', stops);
      }
      else {
        var favoriteStops = [newStop];
        localforage.setItem('favoriteStops', favoriteStops);
      }
    });
  };

  var getAll = function () {
    localforage.getItem('favoriteStops', function (err) {
      if (err) {
        console.log('Error getting all favorite stops: ' + err);
      }
    });
  };

  var remove = function (stop) {
    localforage.getItem('favoriteStops', function (err, stops) {
      for (var i = 0; i < stops.length; i++) {
        if (stops[i].StopId === stop.StopId) {
          stops.splice(i, 1);
        }
      }
      localforage.setItem('favoriteStops', stops, function (err) {
        if (err) {
          console.log('Error removing favorite stop: ' + err);
        }
      });
    });
  };

  function contains (stopId, cb) {
    localforage.getItem('favoriteStops', function (err, stops) {
      if (stops) {
        var filteredStops = _.where(stops, { StopId: stopId });
        if (filteredStops.length > 0) {
          cb(true);
        }
        else {
          cb(false);
        }
      }
      else {
        cb(false);
      }
    });
  }
  return {
    push: push,
    getAll: getAll,
    remove: remove,
    contains: contains
  };
});

{'fraction_non_alphanumeric': 0.14931983549509648, 'fraction_numerical': 0.0018981335020563112, 'mean_word_length': 2.0699029126213593, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1447392', 'n_tokens_mistral': 1039, 'n_tokens_neox': 1037, 'n_words': 215}