Add parsing of AD1 files. Memorize window size and location.

This commit is contained in:
Patrick Fic
2025-03-17 14:27:33 -07:00
parent 10368f8f9e
commit c1949eb5f9
33 changed files with 524 additions and 20 deletions

View File

@@ -0,0 +1,32 @@
/**
* Deep renames all keys in an object to lowercase
* @param obj - The object to transform
* @returns A new object with all keys converted to lowercase
*/
function deepLowerCaseKeys<T = any>(obj: any): T {
if (!obj || typeof obj !== "object") {
return obj;
}
// Handle arrays
if (Array.isArray(obj)) {
return obj.map((item) => deepLowerCaseKeys(item)) as unknown as T;
}
// Handle objects
return Object.keys(obj).reduce(
(result, key) => {
const value = obj[key];
const lowercaseKey = key.toLowerCase();
result[lowercaseKey] =
typeof value === "object" && value !== null
? deepLowerCaseKeys(value)
: value;
return result;
},
{} as Record<string, any>
) as T;
}
export default deepLowerCaseKeys;