const dom = {
  hasClass($dom, className) {
    return $dom.className.match(new RegExp(className))
  },
  /* eslint no-param-reassign: ["error", { "props": false }] */
  addClass($dom, className) {
    if (!this.hasClass($dom, className)) {
      $dom.className += ` ${className}`
    }
  },
  removeClass($dom, className) {
    if (this.hasClass($dom, className)) {
      const reg = new RegExp(`(\\s|^)${className}`)
      $dom.className = $dom.className.replace(reg, '')
    }
  },
}
export default dom
