MCPcopy Index your code
hub / github.com/tinyplex/tinybase / mergeParentThings

Function mergeParentThings

src/ui-react/Provider.tsx:32–46  ·  view source on GitHub ↗
(
  offset: Offset,
  parentValue: ContextValue,
  defaultThing: ThingsByOffset[Offset] | undefined,
  thingsById: ThingsById<ThingsByOffset>[Offset] | undefined,
  extraThingsById: ExtraThingsById,
)

Source from the content-addressed store, hash-verified

30export const OFFSET_SYNCHRONIZER = 7;
31
32const mergeParentThings = <Offset extends Offsets>(
33 offset: Offset,
34 parentValue: ContextValue,
35 defaultThing: ThingsByOffset[Offset] | undefined,
36 thingsById: ThingsById<ThingsByOffset>[Offset] | undefined,
37 extraThingsById: ExtraThingsById,
38): [ThingsByOffset[Offset] | undefined, ThingsById<ThingsByOffset>[Offset]] => [
39 defaultThing ??
40 (parentValue[offset * 2] as ThingsByOffset[Offset] | undefined),
41 {
42 ...parentValue[offset * 2 + 1],
43 ...thingsById,
44 ...extraThingsById[offset],
45 },
46];
47
48export const Provider: typeof ProviderDecl = ({
49 store,

Callers 1

ProviderFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…