<commit_before>'use strict';

var app = app || {};

(function (module) {

  function WorkExperience(rawWorkData) {
    this.company = rawWorkData.company;
    this.jobTitle = rawWorkData.jobTitle;
    this.years = rawWorkData.years;
    this.description = rawWorkData.description;
  }

  WorkExperience.all = [];

  WorkExperience.prototype.toHtml = function () {
    var template = Handlebars.compile($('#work-template').text());
    return template(this);
  };

  WorkExperience.fetchAll = function () {
    if (localStorage.rawWorkData) {
      populateWork(JSON.parse(localStorage.rawWorkData));
      initIndexPage();
    } else {
      $.getJSON('./data/rawData.json')
        .then(function (rawWorkData) {
          populateWork(rawWorkData);
          localStorage.rawWorkData = JSON.stringify(rawWorkData);
          initIndexPage();
        }, function (err) {
          console.error(err);
        });
    }
  };
  module.WorkExperience = WorkExperience;
}(app));


var workView = {};

workView.handleMainNav = function () {
  $('.main-nav').on('click', '.tab', function () {
    event.preventDefault();
    $('.opening').hide();
    $('.tab-content').hide();
    $('#' + $(this).data('content')).fadeIn();
  });
};

function populateWork(rawWorkData) {
  // rawWorkData.forEach(function (obj) {
  //   app.WorkExperience.all.push(new app.WorkExperience(obj));
  // });
  rawWorkData.map(obj => app.WorkExperience.all.push(new app.WorkExperience(obj)));
  app.WorkExperience.all.forEach(function (obj) {
    $('#engineer').append(obj.toHtml());
  });
}


function initIndexPage() {
  $('.tab-content').hide();
};<commit_msg>tried a reduce method and eslint - had some errors I didnt understand<commit_after>'use strict';

var app = app || {};

(function (module) {

  function WorkExperience(rawWorkData) {
    this.company = rawWorkData.company;
    this.jobTitle = rawWorkData.jobTitle;
    this.years = rawWorkData.years;
    this.description = rawWorkData.description;
  }

  WorkExperience.all = [];

  WorkExperience.prototype.toHtml = function () {
    var template = Handlebars.compile($('#work-template').text());
    return template(this);
  };

  WorkExperience.fetchAll = function () {
    if (localStorage.rawWorkData) {
      populateWork(JSON.parse(localStorage.rawWorkData));
      initIndexPage();
    } else {
      $.getJSON('./data/rawData.json')
        .then(function (rawWorkData) {
          populateWork(rawWorkData);
          localStorage.rawWorkData = JSON.stringify(rawWorkData);
          initIndexPage();
        }, function (err) {
          console.error(err);
        });
    }
  };
  module.WorkExperience = WorkExperience;
}(app));


var workView = {};

workView.handleMainNav = function () {
  $('.main-nav').on('click', '.tab', function () {
    event.preventDefault();
    $('.opening').hide();
    $('.tab-content').hide();
    $('#' + $(this).data('content')).fadeIn();
  });
};

function populateWork(rawWorkData) {
  // rawWorkData.forEach(function (obj) {
  //   app.WorkExperience.all.push(new app.WorkExperience(obj));
  // });

  rawWorkData.map(obj => app.WorkExperience.all.push(new app.WorkExperience(obj)));

  app.WorkExperience.all.forEach(function (obj) {
    $('#engineer').append(obj.toHtml());
  });
}


function initIndexPage() {
  $('.tab-content').hide();
  // Trying a reduce function
// var numJobs = [32, 34, 65, 29, 55];
//   var numJobsArray = numJobs.reduce((acc, curr) => acc + curr);
};
{'fraction_non_alphanumeric': 0.1777264858626659, 'fraction_numerical': 0.0028851702250432777, 'mean_word_length': 3.328339575530587, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '3821614', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1093, 'n_words': 170}