mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-09 06:33:03 -04:00
add Native settings implementation (#2346)
Co-authored-by: vee <vendicated@riseup.net>
This commit is contained in:
parent
0f9acba59e
commit
f21db5cb01
5 changed files with 43 additions and 22 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue