MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / addContextToList

Function addContextToList

src/components/TaskContextMenu.ts:88–97  ·  view source on GitHub ↗
(
	contexts: string[] | undefined,
	context: string
)

Source from the content-addressed store, hash-verified

86}
87
88export function addContextToList(
89 contexts: string[] | undefined,
90 context: string
91): string[] | undefined {
92 const value = normalizeContextValue(context);
93 const current = normalizeContextList(contexts);
94 if (!value) return current.length > 0 ? current : undefined;
95 if (current.includes(value)) return current;
96 return [...current, value];
97}
98
99export function removeContextFromList(
100 contexts: string[] | undefined,

Callers 3

toggleContextInListFunction · 0.85
openContextInputMethod · 0.85

Calls 2

normalizeContextValueFunction · 0.85
normalizeContextListFunction · 0.85

Tested by

no test coverage detected