<commit_before>'use strict';

var Helpers = require('./helpers');
var definitions = require('./definitions');

exports.email = function() {
  return this.userName() + "@" + this.domainName();
};

exports.userName = function() {
  switch(Helpers.randomNumber(2))
  {
    case 0:
      return Helpers.randomize(definitions.first_name());
    case 1:
      return Helpers.randomize(definitions.first_name()) + Helpers.randomize([".", "_"]) + Helpers.randomize(definitions.last_name()) ;
  }
};

exports.domainName = function() {
  return this.domainWord() + "." + Helpers.randomize(definitions.domain_suffix());
};

exports.domainWord = function() {
  return Helpers.randomize(definitions.first_name()).toLowerCase();
};

exports.ip = function() {
  var i;
  var randNum = function() {
    return (Math.random()*254 + 1).toFixed(0);
  };

  var result = [];
  for(i = 0; i < 4; i++) {
    result[i] = randNum();
  }

  return result.join(".");
};

exports.ipv6 = function() {
  var group;
  var result = [];
  var i, j;

  for(i = 0; i < 8; i++) {
    group = '';
    for(j = 0; j < 4; j++) {
      group += Helpers.randomNumber(15).toString(16);
    }
    result.push(group);
  }
  return result.join(":");
};
<commit_msg>Refactored and added ndoc comments to internet section<commit_after>'use strict';

/**
 * class Internet
 *
 **/


var Helpers = require('./helpers');
var definitions = require('./definitions');


/**
 * Internet#email() -> String
 *
 * Generate email :-)
 *
 ***/
exports.email = function() {
  return this.userName() + "@" + this.domainName();
};


/**
 * Internet#userName() -> String
 *
 * Generate nickname.
 * Randomly chose format `first_name` or `first_name[.|_]last_name`
 *
 ***/
exports.userName = function() {
  if (Helpers.randomNumber(2) === 0)
  {
    return Helpers.randomize(definitions.first_name());
  }
  return Helpers.randomize(definitions.first_name()) +
          Helpers.randomize([".", "_"]) +
          Helpers.randomize(definitions.last_name()) ;
};


/**
 * Internet#domainName() -> String
 *
 * Generate domain.
 *
 ***/
exports.domainName = function() {
  return this.domainWord() + "." +
          Helpers.randomize(definitions.domain_suffix());
};


/**
 * Internet#domainWord() -> String
 *
 * Generate domain without dot suffix
 *
 ***/
exports.domainWord = function() {
  // lorem can return word with apostrophe
  return Helpers.randomize(definitions.first_name())
          .replace(/[^a-z]/gi, '')
          .toLowerCase();
};


/**
 * Internet#IPv4() -> String
 *
 * Generate IP address
 *
 ***/
exports.IPv4 = function() {
  var i;
  var result = [];

  for(i = 0; i < 4; i++) {
    result[i] = (Math.random()*254 + 1).toFixed(0);
  }

  return result.join(".");
};


/**
 * Internet#IPv6() -> String
 *
 * Generate IPv6 address
 *
 ***/
exports.IPv6 = function() {
  var group;
  var result = [];
  var i, j;

  for(i = 0; i < 8; i++) {
    group = '';
    for(j = 0; j < 4; j++) {
      group += Helpers.randomNumber(15).toString(16);
    }
    result.push(group);
  }
  return result.join(":");
};

{'fraction_non_alphanumeric': 0.19660352710646636, 'fraction_numerical': 0.013389941214892228, 'mean_word_length': 3.1504065040650406, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 9, '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': '4961563', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1036, 'n_words': 207}