a tool for shared writing and social publishing
1type PreferencesInput = {
2 showComments?: boolean;
3 showMentions?: boolean;
4 showRecommends?: boolean;
5 showPrevNext?: boolean;
6} | null;
7
8export function mergePreferences(
9 documentPrefs?: PreferencesInput,
10 publicationPrefs?: PreferencesInput,
11): {
12 showComments?: boolean;
13 showMentions?: boolean;
14 showRecommends?: boolean;
15 showPrevNext?: boolean;
16} {
17 return {
18 showComments: documentPrefs?.showComments ?? publicationPrefs?.showComments,
19 showMentions: documentPrefs?.showMentions ?? publicationPrefs?.showMentions,
20 showRecommends:
21 documentPrefs?.showRecommends ?? publicationPrefs?.showRecommends,
22 showPrevNext: publicationPrefs?.showPrevNext,
23 };
24}