packages/building-webpack/dom5-fork/index.js
function nodeWalkAll(node, predicate, matches, getChildNodes) {
  if (getChildNodes === void 0) {
    getChildNodes = module.exports.defaultChildNodes;
  }
  if (!matches) {
    matches = [];
  }
  if (predicate(node)) {
    matches.push(node);
  }
  var childNodes = getChildNodes(node);
  if (childNodes) {
    for (var i = 0; i < childNodes.length; i++) {
      nodeWalkAll(childNodes[i], predicate, matches, getChildNodes);
    }
  }
  return matches;
}
function nodeWalkAll(node, predicate, matches, getChildNodes) {
  if (getChildNodes === void 0) {
    getChildNodes = module.exports.defaultChildNodes;
  }
  if (!matches) {
    matches = [];
  }
  if (predicate(node)) {
    matches.push(node);
  }
  var childNodes = getChildNodes(node);
  if (childNodes) {
    for (var i = 0; i < childNodes.length; i++) {
      nodeWalkAll(childNodes[i], predicate, matches, getChildNodes);
    }
  }
  return matches;
}
Walk the tree down from `node`, applying the `predicate` function.
All nodes matching the predicate function from `node` to leaves will be
returned.