feature: improve route for extensions

This commit is contained in:
Jean-Baptiste Pasquier 2021-05-20 16:59:49 +02:00
parent b7085a171e
commit e07cafb5c8
2 changed files with 24 additions and 16 deletions

View File

@ -1,8 +1,12 @@
window.hubl.getRoute = (type, returnFirst = false) => { window.hubl.getRoute = (type, returnFirst = false) => {
let availables = window.hubl.components.filter(c => c.type == type || c.uniq == type); let availables = window.hubl.components.filter(c => c.type == type || c.uniq == type);
availables.map(c => { window.hubl.components.forEach(c => {
if (c.extensions) { if (c.extensions) {
c.extensions.forEach(e => availables.push(e.type)); c.extensions.forEach(e => {
if (e.type == type || e.uniq == type) {
availables.push(e.type);
}
});
} }
}); });
if (availables.length > 1) { if (availables.length > 1) {

View File

@ -12,9 +12,13 @@
let routes = new Set(); let routes = new Set();
const getRoute = (type, returnFirst = false) => { const getRoute = (type, returnFirst = false) => {
let availables = components.filter(c => c.type == type || c.uniq == type); let availables = components.filter(c => c.type == type || c.uniq == type);
availables.map(c => { components.forEach(c => {
if (c.extensions) { if (c.extensions) {
c.extensions.forEach(e => availables.push(e.type)); c.extensions.forEach(e => {
if (e.type == type || e.uniq == type) {
availables.push(e.type);
}
});
} }
}); });
if (availables.length > 1) { if (availables.length > 1) {