Skip to content
Permalink
6775eba989
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
14 lines (13 sloc) 533 Bytes
import type { CobaltSettings } from "$lib/types/settings";
import defaults from "./defaults";
export default function lazySettingGetter(settings: CobaltSettings) {
// Returns the setting value only if it differs from the default.
return <
Context extends Exclude<keyof CobaltSettings, 'schemaVersion'>,
Id extends keyof CobaltSettings[Context]
>(context: Context, key: Id) => {
if (defaults[context][key] !== settings[context][key]) {
return settings[context][key];
}
}
}