<commit_before>angular.module('apiMock', [])

	.config(function ($httpProvider) {
		$httpProvider.interceptors.push('httpInterceptor');
	})

	.factory('mockSwitch', function() {
		return {
			mockApi: function() {
				return location.search.toLowerCase().indexOf('apimock=true') > -1 ||
               location.hash.toLowerCase().indexOf('apimock=true') > -1;
			}
		};
	})

	.provider('httpInterceptor', function() {
    var config = {
      mockDataPath: '/mock_data',
      apiPath: '/api'
    };

    this.config = function (options) {
      angular.extend(config, options);
    };

		function HttpInterceptor($q, mockSwitch) {
			var doMock = mockSwitch.mockApi();

      this.apiMocked = mockSwitch.mockApi;
      this.request = function (req) {
				if (doMock && req) {
					if (req.url.indexOf(config.apiPath) === 0) {
						var path = req.url.substring(config.apiPath.length);
						req.url = config.mockDataPath + path + '.' + req.method.toLowerCase() + '.json';
					}
				}

				return req || $q.when(req);
			};
		}

		this.$get = function ($q, mockSwitch) {
			return new HttpInterceptor($q, mockSwitch);
		};
	});<commit_msg>Fix spacing.<commit_after>angular.module('apiMock', [])

angular.module('apiMock', [])

.config(function ($httpProvider) {
  $httpProvider.interceptors.push('httpInterceptor');
})

.factory('mockSwitch', function() {
  return {
    mockApi: function() {
      return location.search.toLowerCase().indexOf('apimock=true') > -1 ||
      location.hash.toLowerCase().indexOf('apimock=true') > -1;
    }
  };
})

.provider('httpInterceptor', function() {
  var config = {
    mockDataPath: '/mock_data',
    apiPath: '/api'
  };

  this.config = function (options) {
    angular.extend(config, options);
  };

  function HttpInterceptor($q, mockSwitch) {
    var doMock = mockSwitch.mockApi();

    this.apiMocked = mockSwitch.mockApi;
    this.request = function (req) {
      if (doMock && req) {
        if (req.url.indexOf(config.apiPath) === 0) {
          var path = req.url.substring(config.apiPath.length);
          req.url = config.mockDataPath + path + '.' + req.method.toLowerCase() + '.json';
        }
      }

      return req || $q.when(req);
    };
  }

  this.$get = function ($q, mockSwitch) {
    return new HttpInterceptor($q, mockSwitch);
  };
});
{'fraction_non_alphanumeric': 0.1740451388888889, 'fraction_numerical': 0.0026041666666666665, 'mean_word_length': 3.0367775831873907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2464507', 'n_tokens_mistral': 803, 'n_tokens_neox': 749, 'n_words': 128}