packages/building-webpack/dom5-fork/index.js
function nodeWalk(node, predicate, getChildNodes) {
  if (getChildNodes === void 0) {
    getChildNodes = module.exports.defaultChildNodes;
  }
  if (predicate(node)) {
    return node;
  }
  var match = null;
  var childNodes = getChildNodes(node);
  if (childNodes) {
    for (var i = 0; i < childNodes.length; i++) {
      match = nodeWalk(childNodes[i], predicate, getChildNodes);
      if (match) {
        break;
      }
    }
  }
  return match;
}
function nodeWalk(node, predicate, getChildNodes) {
  if (getChildNodes === void 0) {
    getChildNodes = module.exports.defaultChildNodes;
  }
  if (predicate(node)) {
    return node;
  }
  var match = null;
  var childNodes = getChildNodes(node);
  if (childNodes) {
    for (var i = 0; i < childNodes.length; i++) {
      match = nodeWalk(childNodes[i], predicate, getChildNodes);
      if (match) {
        break;
      }
    }
  }
  return match;
}
Walk the tree down from `node`, applying the `predicate` function.
Return the first node that matches the given predicate.

@returns `null` if no node matches, parse5 node object if a node matches.