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

Function toControl

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

Source from the content-addressed store, hash-verified

10import { changeKey, latestChanges, useFeedTuneState } from './useFeedTuneState';
11
12const toControl = <Mode>(
13 { mode, weight, duration }: ControlValue<Mode>,
14 off?: Mode,
15): FeedControl<Mode> | undefined =>
16 mode || weight !== undefined
17 ? {
18 mode: weight === 0 && off ? off : (mode ?? null),
19 weight: weight || null,
20 expiresAt: getExpiresAt(duration),
21 }
22 : undefined;
23
24export interface UseFeedTune extends UseFeedTuneState {
25 feedControls: UseFeedControls;

Callers 1

useFeedTuneFunction · 0.85

Calls 1

getExpiresAtFunction · 0.90

Tested by

no test coverage detected