function toggleClass(el, type, val) {
  el && el.classList[val ? type : 'toggle'](val || type);
}
Toggle class
@param {Element|null} el The element that needs the class to be toggled
@param {string} type The type of action to be performed on the classList (toggle by default)
@param {String} val Name of the class to be toggled
@void
@example
toggleClass(el, 'active') => el.classList.toggle('active')
toggleClass(el, 'add', 'active') => el.classList.add('active')