MCPcopy Create free account
hub / github.com/fontsource/fontsource / toggleKey

Function toggleKey

website/app/components/preview/toggles.ts:5–19  ·  view source on GitHub ↗
(
	values: Record<string, boolean>,
	value: string | number,
)

Source from the content-addressed store, hash-verified

3 * are stored.
4 */
5export const toggleKey = (
6 values: Record<string, boolean>,
7 value: string | number,
8): Record<string, boolean> => {
9 const key = String(value);
10 const next = { ...values };
11
12 if (next[key]) {
13 delete next[key];
14 } else {
15 next[key] = true;
16 }
17
18 return next;
19};
20
21/**
22 * Toggle one active key while ensuring at least one key stays selected.

Callers 2

toggleKeyKeepOneFunction · 0.85
toggleVariableAxisFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected