Skip to content
Permalink
f681d64416
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
@Sticks
Latest commit 36bb82c Sep 14, 2024 History
1 contributor

Users who have contributed to this file

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];
}
}
}