make flags not have to all be specified

This commit is contained in:
Percs 2024-10-03 21:32:33 -05:00
parent 1161610cb0
commit 293aeb2956

View file

@ -37,7 +37,17 @@ export class ScramjetController {
}, },
}; };
this.config = Object.assign({}, defaultConfig, config); const deepMerge = (target: any, source: any): any => {
for (const key in source) {
if (source[key] instanceof Object && key in target) {
Object.assign(source[key], deepMerge(target[key], source[key]));
}
}
return Object.assign(target || {}, source);
};
this.config = deepMerge(defaultConfig, config);
} }
async init(serviceWorkerPath: string): Promise<ServiceWorkerRegistration> { async init(serviceWorkerPath: string): Promise<ServiceWorkerRegistration> {