Skip to content

Commit

Permalink
feat(classMapper): add findClassByName back
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Jul 26, 2024
1 parent 48de892 commit 2b8d2ae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/class-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ export const classModuleMap: Map<ModuleID, ClassModule> = createModuleMapping((m
return false;
});

export const classMap = classModuleMap.values();
export const classMap = [...classModuleMap.values()];

export function findClass(id: string, name: string): string | void {
return classModuleMap.get(id)?.[name];
}

export function findClassByName(name: string): string | void {
return classMap.find((m) => m[name])?.[name];
}

export function findClassModule(filter: (module: any) => boolean): ClassModule | void {
// TODO optimize
return [...classModuleMap.values()].find((m) => filter(m));
return classMap.find((m) => filter(m));
}

export function unminifyClass(minifiedClass: string): string | void {
Expand Down

0 comments on commit 2b8d2ae

Please sign in to comment.