{"size": 628, "ext": "js", "max_stars_repo_path": "index.js", "max_stars_repo_name": "otjs/ot-client", "max_stars_repo_stars_event_min_datetime": "2015-04-25T22:53:14.000Z", "max_stars_repo_stars_event_max_datetime": "2015-04-25T22:53:14.000Z", "max_issues_repo_path": "index.js", "max_issues_repo_name": "otjs/ot-client", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "index.js", "max_forks_repo_name": "otjs/ot-client", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.6551724138, "max_line_length": 44, "alphanum_fraction": 0.4968152866}
var adiff = require('adiff')();

exports.diff = function(reference, input) {
  var result = adiff.diff(reference, input);
  var actions = [];
  result.forEach(function(action) {
    var i;
    var index = action[0];
    var deleted = action[1];
    if (deleted > 0) {
      for (i = deleted - 1; i >= 0; --i) {
        actions.push({
          type: 'del',
          line: index + i
        });
      }
    }
    var additions = action.slice(2);
    for (i = 0; i < additions.length; ++i) {
      actions.push({
        type: 'add',
        line: index + i,
        text: additions[i]
      });
    }
  });
  return actions;
};
