mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-17 18:37:04 -04:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
8222eb430e
42 changed files with 450 additions and 289 deletions
|
@ -56,11 +56,14 @@ export const filters = {
|
|||
: m => props.every(p => m[p] !== void 0),
|
||||
|
||||
byCode: (...code: CodeFilter): FilterFn => {
|
||||
code = code.map(canonicalizeMatch);
|
||||
return m => {
|
||||
const parsedCode = code.map(canonicalizeMatch);
|
||||
const filter = m => {
|
||||
if (typeof m !== "function") return false;
|
||||
return stringMatches(Function.prototype.toString.call(m), code);
|
||||
return stringMatches(Function.prototype.toString.call(m), parsedCode);
|
||||
};
|
||||
|
||||
filter.$$vencordProps = [...code];
|
||||
return filter;
|
||||
},
|
||||
byStoreName: (name: StoreNameFilter): FilterFn => m =>
|
||||
m.constructor?.displayName === name,
|
||||
|
@ -131,8 +134,7 @@ export const find = traceFunction("find", function find(filter: FilterFn, { isIn
|
|||
return isWaitFor ? [found, key] : found;
|
||||
}
|
||||
|
||||
// the length check makes search about 20% faster
|
||||
for (const nestedMod in mod.exports) if (nestedMod.length <= 3) {
|
||||
for (const nestedMod in mod.exports) {
|
||||
const nested = mod.exports[nestedMod];
|
||||
if (nested && filter(nested)) {
|
||||
return isWaitFor ? [nested, key] : nested;
|
||||
|
@ -163,7 +165,7 @@ export function findAll(filter: FilterFn) {
|
|||
|
||||
if (mod.exports.default && filter(mod.exports.default))
|
||||
ret.push(mod.exports.default);
|
||||
else for (const nestedMod in mod.exports) if (nestedMod.length <= 3) {
|
||||
else for (const nestedMod in mod.exports) {
|
||||
const nested = mod.exports[nestedMod];
|
||||
if (nested && filter(nested)) ret.push(nested);
|
||||
}
|
||||
|
@ -226,16 +228,15 @@ export const findBulk = traceFunction("findBulk", function findBulk(...filterFns
|
|||
break;
|
||||
}
|
||||
|
||||
for (const nestedMod in mod.exports)
|
||||
if (nestedMod.length <= 3) {
|
||||
const nested = mod.exports[nestedMod];
|
||||
if (nested && filter(nested)) {
|
||||
results[j] = nested;
|
||||
filters[j] = undefined;
|
||||
if (++found === length) break outer;
|
||||
continue outer;
|
||||
}
|
||||
for (const nestedMod in mod.exports) {
|
||||
const nested = mod.exports[nestedMod];
|
||||
if (nested && filter(nested)) {
|
||||
results[j] = nested;
|
||||
filters[j] = undefined;
|
||||
if (++found === length) break outer;
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue