<commit_before>;(function() {

  angular
    .module('app.services.user', [])
    .factory('user', user);

  user.$inject = ['$http'];

  /**
   * Service to store info about the session user. Provides way to register
   * callbacks on factory to be executed after the data requests have been
   * resolved (e.g. a callback to stop a loading animation).
   */
  function user($http) {
    var resolved = false;
    var fnCallbacks = [];
    var user;
    var factory = {
      getUser: getUser,
      registerCb: registerCb
    };

    // Get user data from server
    fetchUser().then(function() {
      // After getting info, mark as resolved and run registered callbacks
      resolved = true;
      console.log('fetching user', resolved, arguments);
      fnCallbacks.forEach(function(cb) {
        cb();
      });
    });

    return factory;

    ////////

    /**
     * returns the currently logged in user
     * @return {Object} current user
     */
    function getUser() {
      return user;
    }

    /**
     * stores callbacks registered by consumers to be run after service
     * resolves
     * @param  {Function} cb Callback to be run after resolve
     * @return {undefined}  None
     */
    function registerCb(cb) {
      if (resolved) {
        cb();
      } else {
        fnCallbacks.push(cb);
      }
    }

    /**
     * checks with server to retrieve user object associated with this session.
     * Stores info on private variable `user`.
     * @return {Object} user object
     */
    function fetchUser() {
      return $http.get('/api/user')
        .then(function(res) {
          user = res.data;
          console.log('got the user', arguments);
          return user;
        }).catch(function(err) {
          console.error('Error fetching using:', err);
        });
    }
  }

})();<commit_msg>clean lint<commit_after>;(function() {

  angular
    .module('app.services.user', [])
    .factory('user', user);

  user.$inject = ['$http'];

  /**
   * Service to store info about the session user. Provides way to register
   * callbacks on factory to be executed after the data requests have been
   * resolved (e.g. a callback to stop a loading animation).
   */
  function user($http) {
    var resolved = false;
    var fnCallbacks = [];
    var sessionUser;
    var factory = {
      getUser: getUser,
      registerCb: registerCb
    };

    // Get user data from server
    fetchUser().then(function() {
      // After getting info, mark as resolved and run registered callbacks
      resolved = true;
      console.log('fetching user', resolved, arguments);
      fnCallbacks.forEach(function(cb) {
        cb();
      });
    });

    return factory;

    ////////

    /**
     * returns the currently logged in user
     * @return {Object} current user
     */
    function getUser() {
      return sessionUser;
    }

    /**
     * stores callbacks registered by consumers to be run after service
     * resolves
     * @param  {Function} cb Callback to be run after resolve
     * @return {undefined}  None
     */
    function registerCb(cb) {
      if (resolved) {
        cb();
      } else {
        fnCallbacks.push(cb);
      }
    }

    /**
     * checks with server to retrieve user object associated with this session.
     * Stores info on private variable `user`.
     * @return {Object} user object
     */
    function fetchUser() {
      return $http.get('/api/user')
        .then(function(res) {
          sessionUser = res.data;
          console.log('got the user', arguments);
          return sessionUser;
        }).catch(function(err) {
          console.error('Error fetching using:', err);
        });
    }
  }

})();
{'fraction_non_alphanumeric': 0.12172031376791993, 'fraction_numerical': 0.0, 'mean_word_length': 2.0868113522537564, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6335690', 'n_tokens_mistral': 1047, 'n_tokens_neox': 1022, 'n_words': 329}