Get path / folder structure via part of folder structur

strange subject I know. I’m looking for a way in JS (due to usage with templater) to get “900 A Folder/910 A Folder Inside a Folder” by searching for “910”
return should be a string. Any idea?

found the solution for templater:

async function get_pathFromNumber(pathNumber) {
    const folders = app.vault.getAllLoadedFiles().filter(i => i.children).map(folder => folder.path);
    const index = folders.findIndex(element => {
      if (element.includes(pathNumber)) {
        return true;
      }
    });
    if(index == -1){
      throw new Error('Path not found for: ' + pathNumber);
    }
 
    return folders[index];
}

module.exports = get_pathFromNumber;