window.orbit.getRoute = (type, returnFirst = false) => { let availables = window.orbit.components.filter(c => c.type == type || c.uniq == type); window.orbit.components.forEach(c => { if (c.extensions) { c.extensions.forEach(e => { if (e.type == type || e.uniq == type) { availables.push(e); } }); } }); if (availables.length > 1) { if (returnFirst) { return availables[0].route; } else { return availables[availables.length - 1].route; } } else if (availables.length < 1) { console.error(`No component found for route ${type}`); } else { return availables[0].route; } }