Get all tags using cheerio (or any other package)

Is there a way to get all tags that are used in an html document using cheerio (or other DOM-parsing package)?

Example input:

<div class="test">
<h1>Hello</h1>
<p>world</p>
</div>

Expected output

{
  div: 1,
  h1: 1,
  p: 1
}