code: function extractTypes (elements, Types) {
    function inner (elements, res) {
      const l = elements.length
      for (let i = 0; i < l; i++) {
        const e = elements[i]
        const index = Types.indexOf(e.constructor)
        if (index > -1) {
          res[index].push(e)
        } else if (e instanceof Element) {
          inner(e.content, res)
          inner(e.endContent, res)
        }
      }
    }
  
    const res = Types.map(() => [])
    inner(elements, res)
    return res
  }
docs: extracts 'elements' of particular types from the tree of elements (for extracting HeadWrapper and Asset 'elements')