You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
731 B
42 lines
731 B
2 years ago
|
//alert("hi :)")
|
||
|
|
||
|
//MODULE FINDER
|
||
|
const getAllModules = () => {
|
||
|
const fullMods = []
|
||
|
for (const k in modules) {
|
||
|
try {
|
||
|
fullMods.push([__r(Number(k)),Number(k)])
|
||
|
} catch (e) {}
|
||
|
}
|
||
|
return fullMods
|
||
|
}
|
||
|
|
||
|
const findModules = (filter) => {
|
||
|
const mod = []
|
||
|
getAllModules().forEach((item, idx) => {
|
||
|
if (item[0] !== undefined && item[0] !== {}) {
|
||
|
if (filter(item[0])) {
|
||
|
mod.push(modules[item[1]].publicModule)
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
for (const k in mod[0]) {
|
||
|
//alert(`${k}\n${mod[0][k]}`)
|
||
|
}
|
||
|
return mod
|
||
|
}
|
||
|
|
||
|
function findByProps(prop) {
|
||
|
return findModules((mod) => {return !!mod[prop]})[0]
|
||
|
}
|
||
|
|
||
|
function findAllByProps(prop) {
|
||
|
return findModules(mod => !!mod[prop])
|
||
|
}
|
||
|
|
||
|
export default {
|
||
|
findModules,
|
||
|
findByProps,
|
||
|
findAllByProps
|
||
|
}
|