<commit_before>'use strict';

var err = require('./errors.js');
var turfArea = require('turf-area');
var validator = require('validator');
var areaLimit;

var parseGeoJson = function (geojson) {
  // if we receive an object, assume it's GeoJSON, if not, try and parse
  if (typeof geojson === 'object') {
    return geojson;
  } else {
    try {
      return JSON.parse(geojson);
    } catch (e) {
      err.invalidGeoJsonError();
    }
  }
};

module.exports.parseGeoJson = parseGeoJson;

var areaNotLarge = function (geojson) {
  if (validator.isNumeric(process.env.AREA_LIMIT)) {
    areaLimit = parseInt(process.env.AREA_LIMIT, 10);
  } else {
    areaLimit = 500000;
  }

  // calculate area
  var area = turfArea(geojson) / 1000000;

  // If it is smaller than Nigeria use geohash
  if (area < areaLimit) {
    return true;
  } else {
    return false;
  }
};

module.exports.areaNotLarge = areaNotLarge;

// This is a custom key generation function for hapi cache system
var customGenerateKey = function (params) {
  return JSON.stringify(params);
};

module.exports.customGenerateKey = customGenerateKey;
<commit_msg>include url path<commit_after>'use strict';

var err = require('./errors.js');
var turfArea = require('turf-area');
var validator = require('validator');
var areaLimit;

var parseGeoJson = function (geojson) {
  // if we receive an object, assume it's GeoJSON, if not, try and parse
  if (typeof geojson === 'object') {
    return geojson;
  } else {
    try {
      return JSON.parse(geojson);
    } catch (e) {
      err.invalidGeoJsonError();
    }
  }
};

module.exports.parseGeoJson = parseGeoJson;

var areaNotLarge = function (geojson) {
  if (validator.isNumeric(process.env.AREA_LIMIT)) {
    areaLimit = parseInt(process.env.AREA_LIMIT, 10);
  } else {
    areaLimit = 500000;
  }

  // calculate area
  var area = turfArea(geojson) / 1000000;

  // If it is smaller than Nigeria use geohash
  if (area < areaLimit) {
    return true;
  } else {
    return false;
  }
};

module.exports.areaNotLarge = areaNotLarge;

// This is a custom key generation function for hapi cache system
var customGenerateKey = function (params, request) {
  return request.url.path + '?' + JSON.stringify(params);
};

module.exports.customGenerateKey = customGenerateKey;

{'fraction_non_alphanumeric': 0.1215566243987757, 'fraction_numerical': 0.013117621337997376, 'mean_word_length': 3.5039370078740157, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4848156', 'n_tokens_mistral': 774, 'n_tokens_neox': 737, 'n_words': 204}