{"size": 533, "ext": "js", "max_stars_repo_path": "public/js/view-model.js", "max_stars_repo_name": "ipelovski/users-api", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/js/view-model.js", "max_issues_repo_name": "ipelovski/users-api", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/js/view-model.js", "max_forks_repo_name": "ipelovski/users-api", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.5, "max_line_length": 55, "alphanum_fraction": 0.6153846154}
'use strict';

const Data = require('./data');

function ViewModel(value = {}) {
  Object.assign(this, value);
}

ViewModel.prototype.bindings = function () {
  return {
    oninput: (e) => {
      let propertyName = e.target.name || e.target.id;
      this[propertyName] = e.target.value;
    }
  };
};

ViewModel.fromData = function (data) {
  return new ViewModel(Object.assign({}, data.value));
};

ViewModel.prototype.toData = function () {
  return Data.withValue(this);
};

module.exports = ViewModel;