<commit_before>'use strict';

var _ = require('lodash');
var cacheTimes = require('../web/config/cache-times');
var Joi = require('joi');
var auth = require('./authentications');

var joiValidator = {
  latitude: function () {
    return Joi.number().min(-90).max(90);
  },
  longitude: function () {
    return Joi.number().min(-180).max(180);
  },
  mail: function () {
    return Joi.string().email();
  },
  alpha2: function () {
    return Joi.string().length(2).regex(/[A-Z]{2}/);
  },
  alpha3: function () {
    return Joi.string().length(3).regex(/[A-Z]{3}/);
  },
  continent: function () {
    return Joi.string().length(2).regex(/[A-Z]{2}/);
  },
  twitter: function () {
    return Joi.string().allow('');
  },
  uri: function () {
    return Joi.alternatives().try(Joi.string().uri(), Joi.string());
  },
  optionalUri: function () {
    return Joi.alternatives().try(joiValidator.uri(), Joi.string().valid(''));
  },
  country: function () {
    return Joi.object().keys({
      countryName: Joi.string().required(),
      countryNumber: Joi.number().integer(),
      continent: joiValidator.continent(),
      alpha2: joiValidator.alpha2(),
      alpha3: joiValidator.alpha3(),
      $$hashKey: Joi.optional()
    });
  },
  phone: function () {
    return Joi.string();
  },
  place: function () {
    return Joi.object().keys({<commit_msg>Fix creation of dojo with empty string<commit_after>'use strict';

var _ = require('lodash');
var cacheTimes = require('../web/config/cache-times');
var Joi = require('joi');
var auth = require('./authentications');

var joiValidator = {
  latitude: function () {
    return Joi.number().min(-90).max(90);
  },
  longitude: function () {
    return Joi.number().min(-180).max(180);
  },
  mail: function () {
    return Joi.string().email();
  },
  alpha2: function () {
    return Joi.string().length(2).regex(/[A-Z]{2}/);
  },
  alpha3: function () {
    return Joi.string().length(3).regex(/[A-Z]{3}/);
  },
  continent: function () {
    return Joi.string().length(2).regex(/[A-Z]{2}/);
  },
  twitter: function () {
    return Joi.string().allow('');
  },
  uri: function () {
    return Joi.alternatives().try(Joi.string().uri(), Joi.string());
  },
  optionalUri: function () {
    return Joi.alternatives().try(joiValidator.uri(), Joi.string().empty(''), Joi.string().valid(null));
  },
  country: function () {
    return Joi.object().keys({
      countryName: Joi.string().required(),
      countryNumber: Joi.number().integer(),
      continent: joiValidator.continent(),
      alpha2: joiValidator.alpha2(),
      alpha3: joiValidator.alpha3(),
      $$hashKey: Joi.optional()
    });
  },
  phone: function () {
    return Joi.string();
  },
  place: function () {
    return Joi.object().keys({
{'fraction_non_alphanumeric': 0.21301989150090417, 'fraction_numerical': 0.015913200723327307, 'mean_word_length': 3.308411214953271, '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': '2583352', 'n_tokens_mistral': 943, 'n_tokens_neox': 928, 'n_words': 160}