fix findModuleId
This commit is contained in:
parent
617d55dd0d
commit
c8be348570
1 changed files with 5 additions and 5 deletions
|
@ -218,14 +218,14 @@ export const findBulk = traceFunction("findBulk", function findBulk(...filterFns
|
||||||
* @returns string or null
|
* @returns string or null
|
||||||
*/
|
*/
|
||||||
export const findModuleId = traceFunction("findModuleId", function findModuleId(...code: string[]) {
|
export const findModuleId = traceFunction("findModuleId", function findModuleId(...code: string[]) {
|
||||||
const filter = filters.byCode(...code);
|
outer:
|
||||||
|
|
||||||
for (const id in wreq.m) {
|
for (const id in wreq.m) {
|
||||||
const mod = wreq.m[id];
|
const str = wreq.m[id].toString();
|
||||||
|
|
||||||
if (filter(mod)) {
|
for (const c of code) {
|
||||||
return id;
|
if (!str.includes(c)) continue outer;
|
||||||
}
|
}
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const err = new Error("Didn't find module with code(s):\n" + code.join("\n"));
|
const err = new Error("Didn't find module with code(s):\n" + code.join("\n"));
|
||||||
|
|
Loading…
Reference in a new issue