MCPcopy Create free account
hub / github.com/block/buzz / getTextPayload

Function getTextPayload

desktop/src/shared/api/relayClientShared.ts:79–105  ·  view source on GitHub ↗
(message: unknown)

Source from the content-addressed store, hash-verified

77}
78
79export function getTextPayload(message: unknown) {
80 if (typeof message === "string") {
81 return message;
82 }
83
84 if (
85 typeof message === "object" &&
86 message !== null &&
87 "type" in message &&
88 message.type === "Text" &&
89 "data" in message &&
90 typeof message.data === "string"
91 ) {
92 return message.data;
93 }
94
95 if (
96 typeof message === "object" &&
97 message !== null &&
98 "Text" in message &&
99 typeof message.Text === "string"
100 ) {
101 return message.Text;
102 }
103
104 return null;
105}

Callers 2

handleWsMessageMethod · 0.90
handleWsMessageMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected