forked from Zerthox/BetterDiscord-Plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
518 additions
and
242 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {Exports} from "./raw"; | ||
|
||
export const byExports = (exported: Exports) => { | ||
return (target) => target === exported || (target instanceof Object && Object.values(target).includes(exported)); | ||
}; | ||
|
||
export const byName = (name: string) => { | ||
return (target) => target instanceof Object && Object.values(target).some(byDisplayName(name) as any); | ||
}; | ||
|
||
export const byDisplayName = (name: string) => { | ||
return (target: any) => target?.displayName === name || target?.constructor?.displayName === name; | ||
}; | ||
|
||
export const byProps = (props: string[]) => { | ||
return (target) => target instanceof Object && props.every((prop) => prop in target); | ||
}; | ||
|
||
export const byProtos = (protos: string[]) => { | ||
return (target: any) => target instanceof Object && target.prototype instanceof Object && protos.every((proto) => proto in target.prototype); | ||
}; | ||
|
||
export const bySource = (contents: string[]) => { | ||
// TODO: allow regex? | ||
return (target) => target instanceof Function && contents.every((content) => target.toString().includes(content)); | ||
}; |
Oops, something went wrong.