MCPcopy
hub / github.com/calcom/cal.diy / removeItemByKeyAndValue

Function removeItemByKeyAndValue

packages/lib/hooks/useTypedQuery.ts:97–107  ·  view source on GitHub ↗
(key: J, value: ArrayOutput[J][number])

Source from the content-addressed store, hash-verified

95
96 // Remove item by key and value
97 function removeItemByKeyAndValue<J extends ArrayOutputKeys>(key: J, value: ArrayOutput[J][number]) {
98 const existingValue = parsedQuery[key];
99 if (Array.isArray(existingValue) && existingValue.length > 1) {
100 // @ts-expect-error this is too much for TS it seems
101 const newValue = existingValue.filter((item) => item !== value);
102 setQuery(key, newValue);
103 } else {
104 // @ts-expect-error this is too much for TS it seems
105 removeByKey(key);
106 }
107 }
108
109 // Remove all query params from the URL
110 function removeAllQueryParams() {

Callers 1

TeamsFilterFunction · 0.85

Calls 1

removeByKeyFunction · 0.85

Tested by

no test coverage detected