getNodeNames = (data, element) => {
  // break if no name or children list is empty
  if (!data) return;
  if (!data.name) return;
  if (!data.children.length) return;

  const elementCopy = element;

  // first instance of node
  if (!data.isDOM) elementCopy[data.name] = (elementCopy[data.name] || 0) + 1;

  // iterate through children
  data.children.forEach(child => getNodeNames(child, elementCopy));
}
Build up object containing component names and number of times they appear

@param {object} data - object representing vDOM
@param {object} element - function will build up an object of names and the number of times they appear