mirror of https://github.com/Lissy93/dashy.git
⚡ Adds type checking for section search
This commit is contained in:
parent
11291ae0e6
commit
a5944c1d06
|
@ -64,10 +64,10 @@ export default {
|
|||
/* If an initial URL is specified, then open relevant section */
|
||||
openDefaultSection() {
|
||||
if (!this.initUrl) return;
|
||||
const process = (url) => url.replace(/[^\w\s]/gi, '').toLowerCase();
|
||||
const process = (url) => (url ? url.replace(/[^\w\s]/gi, '').toLowerCase() : undefined);
|
||||
const compare = (item) => (process(item.url) === process(this.initUrl));
|
||||
this.sections.forEach((section, sectionIndex) => {
|
||||
if (section.items.findIndex(compare) !== -1) this.openSection(sectionIndex);
|
||||
this.sections.forEach((section, secIndex) => {
|
||||
if (section.items && section.items.findIndex(compare) !== -1) this.openSection(secIndex);
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue