3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

fuck i owe almeida a donut now

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
Tiago R 2023-10-09 13:56:49 +00:00 committed by GitHub
parent 12d59bc238
commit 7e6fc1f196
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -538,11 +538,16 @@ const baseValues = {
return math_constants[str.toLowerCase()] ?? "";
},
map(obj, key) {
if (typeof obj !== "object" || typeof key !== "string" || typeof obj === "function" || !obj) return "";
return actualMap(obj, key);
function actualMap(obj, key, depth = 0) {
if (depth > 5) return "";
if (!obj || !key || typeof obj !== "object" || typeof key !== "string") return "";
if (Array.isArray(obj)) {
return obj.map((tobj) => tobj[key]);
return obj.map((tobj) => actualMap(tobj, key, depth + 1));
}
return obj[key];
}
},
cases(mod, ...cases) {
if (cases.length === 0) return "";