add Native settings implementation (#2346)

Co-authored-by: vee <vendicated@riseup.net>
This commit is contained in:
Claire 2024-05-11 17:08:17 -07:00 committed by GitHub
parent 0f9acba59e
commit f21db5cb01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 43 additions and 22 deletions

View file

@ -20,25 +20,6 @@ import { Clipboard, Toasts } from "@webpack/common";
import { DevsById } from "./constants";
/**
* Recursively merges defaults into an object and returns the same object
* @param obj Object
* @param defaults Defaults
* @returns obj
*/
export function mergeDefaults<T>(obj: T, defaults: T): T {
for (const key in defaults) {
const v = defaults[key];
if (typeof v === "object" && !Array.isArray(v)) {
obj[key] ??= {} as any;
mergeDefaults(obj[key], v);
} else {
obj[key] ??= v;
}
}
return obj;
}
/**
* Calls .join(" ") on the arguments
* classes("one", "two") => "one two"