helpers for coronabuddy

@require library

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.sleazyfork.org/scripts/403975/808222/helpers%20for%20coronabuddy.js

// Helpers
  
  function templateDOMElement({
    tag = null,
    classList = null,
    innerHTML = null,
    id = null,
    style = null,
  }) {
    if (tag !== null && tag !== undefined) {
      let elm = document.createElement(`${tag}`);
      if (classList) {
        elm.classList.add(classList);
      }
  
      for (let [key, value] of Object.entries(arguments[0])) {
        if (value !== null && key !== "classList" && key !== "tag") {
          elm[key] = value;
        }
      }
      return elm;
    } else {
      throw new Error(`Tag not provided in ${arguments[0]}.`);
    }
  }