Files
discord-decomp/modules/search/tokens/SearchTokensUtils.tsx
T
2026-11-01 12:12:55 +02:00

19 lines
725 B
TypeScript

// Metro module 10107 (f10108).
import RegexUtils from "../../../utils/RegexUtils";
export const ANSWER_IN_REGEX = /(?:\s*#?((?:"(\\\\|\\"|[^\\"])*")|(?:[^\s]+)))/i;
export const GENERIC_REGEX = /(?:\s*([^\s]+))/;
export function makeRegexForOptionsWithNegation(a0) {
return new RegExp(`(?:\\s*(-?(?:${[...a0].sort((a, b) => b.length - a.length).map((item) => RegexUtils.escape(item)).join("|")})))`, "i");
}
export function validateForMapWithNegation(a0, a1, a2) {
const match = a2.getMatch(1);
const r10 = match.startsWith("-");
const r12 = a1[r10 ? match.slice(1) : match];
let r13 = r12 != null && r12 !== "";
if (r13) {
a2.setData.call(a2, a0, r10 ? `-${r12}` : r12);
r13 = true;
}
return r13;
}