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

Function toggleKeyKeepOne

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

Source from the content-addressed store, hash-verified

22 * Toggle one active key while ensuring at least one key stays selected.
23 */
24export const toggleKeyKeepOne = (
25 values: Record<string, boolean>,
26 value: string | number,
27): Record<string, boolean> => {
28 const next = toggleKey(values, value);
29 return Object.keys(next).length === 0 ? values : next;
30};
31
32/**
33 * Toggle one variable axis while keeping `wght` enabled, since published

Callers 3

handleActiveWeightFunction · 0.90
handleActiveFunction · 0.90
handleActiveWeightFunction · 0.90

Calls 1

toggleKeyFunction · 0.85

Tested by

no test coverage detected