MCPcopy Create free account
hub / github.com/dailydotdev/apps / toStored

Function toStored

packages/shared/src/features/feedExplain/useFeedControls.ts:65–77  ·  view source on GitHub ↗
(
  { mode, weight, duration }: ControlValue<Mode>,
  off?: Mode,
)

Source from the content-addressed store, hash-verified

63
64// Mirrors how the API stores it: an exact weight of 0 is the off level.
65const toStored = <Mode>(
66 { mode, weight, duration }: ControlValue<Mode>,
67 off?: Mode,
68): FeedControl<Mode> | null => {
69 if (weight === undefined && !mode) {
70 return null;
71 }
72 return {
73 mode: weight === 0 && off ? off : (mode ?? null),
74 weight: weight || null,
75 expiresAt: getExpiresAt(duration),
76 };
77};
78
79const applyChange = (
80 controls: FeedControls,

Callers 1

applyChangeFunction · 0.85

Calls 1

getExpiresAtFunction · 0.90

Tested by

no test coverage detected