console.log('form-faker: faking data...');
// debugger;
const dictionary = getDictionary();
var inputs = document.getElementsByTagName('input');

for (var i = 0; i < inputs.length; i++) {
  var input = inputs[i];
  if (input.type.toLowerCase() !== 'text' || input.value) {
    continue;
  }

  var name = input.name.toLowerCase();
  var mapping = dictionary.get(name);
  switch (mapping) {
    case 'firstName':
      input.value = faker.name.firstName();
      break;
    case 'lastName':
      input.value = faker.name.firstName();
      break;
    case 'email':
      input.value = faker.internet.email();
      break;
    case 'phone':
      input.value = faker.phone.phoneNumber('(###) ###-####');
      break;
    case 'date-past':
      var date = faker.date.past(50);
      input.value = date.toLocaleDateString();
      break;
    case 'account':
      input.value = faker.finance.account();
      break;
    default:
      if (input.attributes.required) {
        input.value = faker.random.word();
      }
      break;
  }
}

console.log('form-faker: Done!');

function getDictionary() {
  return new Map([
    // firstName
    ['firstname', 'firstName'],
    ['first_name', 'firstName'],
    ['first-name', 'firstName'],
    ['fname', 'firstName'],
    // lastName
    ['lastname', 'lastName'],
    ['last_name', 'lastName'],
    ['last-name', 'lastName'],
    ['lname', 'lastName'],
    // email
    ['email', 'email'],
    ['emailaddress', 'email'],
    ['email_address', 'email'],
    ['email-address', 'email'],
    // phone
    ['phone', 'phone'],
    ['ph', 'phone'],
    ['cellphone', 'phone'],
    ['cell_phone', 'phone'],
    ['cell-phone', 'phone'],
    ['cellph', 'phone'],
    ['cell_ph', 'phone'],
    ['cell-ph', 'phone'],
    ['mobilephone', 'phone'],
    ['mobile_phone', 'phone'],
    ['mobile-phone', 'phone'],
    ['mobileph', 'phone'],
    ['mobile_ph', 'phone'],
    ['mobile-ph', 'phone'],
    ['homephone', 'phone'],
    ['home_phone', 'phone'],
    ['home-phone', 'phone'],
    ['homeph', 'phone'],
    ['home_ph', 'phone'],
    ['home-ph', 'phone'],
    ['hmphone', 'phone'],
    ['hm_phone', 'phone'],
    ['hm-phone', 'phone'],
    ['hmph', 'phone'],
    ['hm_ph', 'phone'],
    ['hm-ph', 'phone'],
    // date-past
    ['birthdate', 'date-past'],
    // account
    ['mrn', 'account'],
  ]);
}

@@ -701,32 +701,630 @@
 );%0A      break;%0A
+    // Address%0A    case 'address1':%0A      input.value = faker.address.streetAddress();%0A      break;%0A    case 'address2':%0A      input.value = faker.address.secondaryAddress();%0A      break;%0A    case 'city':%0A      input.value = faker.address.city();%0A      break;%0A    case 'country':%0A      input.value = 'United States'; // faker.address.country();%0A      break;%0A    case 'county':%0A      input.value = faker.address.county();%0A      break;%0A    case 'state':%0A      input.value = faker.address.state();%0A      break;%0A    case 'zipCode':%0A      input.value = faker.address.zipCode();%0A      break;%0A    // Date%0A
     case 'date-p
@@ -2825,24 +2825,649 @@
 , 'phone'%5D,%0A
+    // Address%0A    %5B'address', 'address1'%5D,%0A    %5B'address1', 'address1'%5D,%0A    %5B'addr', 'address1'%5D,%0A    %5B'addr1', 'address1'%5D,%0A    %5B'address2', 'address2'%5D,%0A    %5B'addr2', 'address2'%5D,%0A    %5B'city', 'city'%5D,%0A    %5B'country', 'country'%5D,%0A    %5B'cntry', 'country'%5D,%0A    %5B'county', 'county'%5D,%0A    %5B'state', 'state'%5D,%0A    %5B'st', 'state'%5D,%0A    %5B'zipcode', 'zipCode'%5D,%0A    %5B'zip', 'zipCode'%5D,%0A    %5B'zip-code', 'zipCode'%5D,%0A    %5B'zip_code', 'zipCode'%5D,%0A    %5B'postalcode', 'zipCode'%5D,%0A    %5B'postal-code', 'zipCode'%5D,%0A    %5B'postal_code', 'zipCode'%5D,%0A    %5B'postcode', 'zipCode'%5D,%0A    %5B'post-code', 'zipCode'%5D,%0A    %5B'post_code', 'zipCode'%5D,%0A
     // date-

address fields - resolves #3