MCPcopy Create free account
hub / github.com/triggerdotdev/jsonhero-web / PropertiesUri

Function PropertiesUri

app/components/Properties/PropertiesString.tsx:217–271  ·  view source on GitHub ↗
({
  value,
  format,
}: {
  value: string;
  format: JSONURIFormat;
})

Source from the content-addressed store, hash-verified

215}
216
217function PropertiesUri({
218 value,
219 format,
220}: {
221 value: string;
222 format: JSONURIFormat;
223}) {
224 let uri = new URL(value);
225
226 let standardProperties: DataTableRow[] = [
227 {
228 key: "href",
229 value: uri.href,
230 },
231 {
232 key: "origin",
233 value: uri.origin,
234 },
235 {
236 key: "protocol",
237 value: uri.protocol,
238 },
239 {
240 key: "hostname",
241 value: uri.hostname,
242 },
243 {
244 key: "pathname",
245 value: uri.pathname,
246 },
247 ];
248
249 if (uri.search) {
250 standardProperties.push({
251 key: "search",
252 value: uri.search,
253 });
254 }
255
256 if (uri.hash) {
257 standardProperties.push({
258 key: "hash",
259 value: uri.hash,
260 });
261 }
262
263 if (format.contentType != null) {
264 standardProperties.push({
265 key: "mimeType",
266 value: format.contentType,
267 });
268 }
269
270 return <DataTable rows={standardProperties} />;
271}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected