MCPcopy
hub / github.com/vercel/streamdown / shouldShowCodeControl

Function shouldShowCodeControl

packages/streamdown/lib/components.tsx:124–143  ·  view source on GitHub ↗
(
  config: ControlsConfig,
  controlType: "copy" | "download"
)

Source from the content-addressed store, hash-verified

122};
123
124const shouldShowCodeControl = (
125 config: ControlsConfig,
126 controlType: "copy" | "download"
127): boolean => {
128 if (typeof config === "boolean") {
129 return config;
130 }
131
132 const codeConfig = config.code;
133
134 if (codeConfig === false) {
135 return false;
136 }
137
138 if (codeConfig === true || codeConfig === undefined) {
139 return true;
140 }
141
142 return codeConfig[controlType] !== false;
143};
144
145const shouldShowMermaidControl = (
146 config: ControlsConfig,

Callers 1

CodeComponentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected