⌈⌋ ⎇ branch:  Bitrhythm


Artifact Content

Artifact c02db925c056e00016052a7f2bd6c87628e667a747decdf12e515da0d098193f:


import { RE_HTML_ATTRS } from './../../global-variables'
/**
 * Minimize risk: only zero or one _space_ between attr & value
 * @param   { String }   html - html string we want to parse
 * @param   { Function } fn - callback function to apply on any attribute found
 */
export default function walkAttributes(html, fn) {
  if (!html) return
  let m
  while (m = RE_HTML_ATTRS.exec(html))
    fn(m[1].toLowerCase(), m[2] || m[3] || m[4])
}