Something went wrong. Try again.
a tool for shared writing and social publishing
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031323334353637383940export type PrevNextDirection = "ltr" | "rtl";
/** Which way along the prev/next row posts get newer. */export function resolvePrevNextDirection( direction: string | undefined,): PrevNextDirection { return direction === "ltr" ? "ltr" : "rtl";}
type PreferencesInput = { showComments?: boolean; showMentions?: boolean; showRecommends?: boolean; showPrevNext?: boolean; showFirstLast?: boolean; prevNextDirection?: string;} | null;
export function mergePreferences( documentPrefs?: PreferencesInput, publicationPrefs?: PreferencesInput,): { showComments?: boolean; showMentions?: boolean; showRecommends?: boolean; showPrevNext?: boolean; showFirstLast?: boolean; prevNextDirection?: string;} { return { showComments: documentPrefs?.showComments ?? publicationPrefs?.showComments, showMentions: documentPrefs?.showMentions ?? publicationPrefs?.showMentions, showRecommends: documentPrefs?.showRecommends ?? publicationPrefs?.showRecommends, showPrevNext: publicationPrefs?.showPrevNext, showFirstLast: publicationPrefs?.showFirstLast, prevNextDirection: publicationPrefs?.prevNextDirection, };}