Figma plugin question: How can I find all groups in a page that have the same name?

I’m building my first Figma plugin and before I can build the next functionality into my plugin, I first need to:

  1. Find all the groups that have the same name
  2. Club the ones with the same name and show them to the user (For example, 2 groups with the name ‘XYZ’, 4 groups with the name ‘ABC’, etc.)

Find all groups using findAllWithCriteria (findAllWithCriteria | Plugin API), then loop through them, record all unique names into a dictionary.

Hi @Gleb , I had earlier checked out the findAllWithCriteria functionality and could get to the following code:

const nodes = figma.currentPage.findAllWithCriteria({
types: [‘GROUP’]
})

However, I’m completely new to TypeScript and I’m not sure about the rest of the code.

Would it be possible for you to help me with a basic block of code to get started with