{"size": 495, "ext": "js", "max_stars_repo_path": "src/ImageFactory.js", "max_stars_repo_name": "michaelrhodes/basicHTML", "max_stars_repo_stars_event_min_datetime": "2017-06-12T14:01:55.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-20T16:51:18.000Z", "max_issues_repo_path": "src/ImageFactory.js", "max_issues_repo_name": "michaelrhodes/basicHTML", "max_issues_repo_issues_event_min_datetime": "2017-06-13T23:06:37.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-30T17:05:57.000Z", "max_forks_repo_path": "src/ImageFactory.js", "max_forks_repo_name": "michaelrhodes/basicHTML", "max_forks_repo_forks_event_min_datetime": "2017-06-12T22:13:24.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-30T13:30:02.000Z"}
{"max_stars_count": 128, "max_issues_count": 55, "max_forks_count": 16, "avg_line_length": 23.5714285714, "max_line_length": 59, "alphanum_fraction": 0.6161616162}
const HTMLElement = require('./HTMLElement');
const Image = require('./Image');

module.exports = function ImageFactory(document, ...size) {
  const [width, height] = size;
  let img = document.createElement('img');
  if (img.constructor === HTMLElement)
    img = new Image(document);
  switch (size.length) {
    case 1:
      img.width = width;
      img.height = width;
      return img;
    case 2:
      img.width = width;
      img.height = height;
      return img;
  }
  return img;
};
