MCPcopy Index your code
hub / github.com/triggerdotdev/jsonhero-web / createFromUrlOrRawJson

Function createFromUrlOrRawJson

app/jsonDoc.server.ts:31–48  ·  view source on GitHub ↗
(
  urlOrJson: string,
  title?: string
)

Source from the content-addressed store, hash-verified

29export type JSONDocument = RawJsonDocument | UrlJsonDocument;
30
31export async function createFromUrlOrRawJson(
32 urlOrJson: string,
33 title?: string
34): Promise<JSONDocument | undefined> {
35 if (isUrl(urlOrJson)) {
36 return createFromUrl(new URL(urlOrJson), title);
37 }
38
39 if (isJSON(urlOrJson)) {
40 return createFromRawJson("Untitled", urlOrJson);
41 }
42
43 // Wrapper for createFromRawJson to handle XML
44 // TODO ? change from urlOrJson to urlOrJsonOrXml
45 if (isXML(urlOrJson)) {
46 return createFromRawXml("Untitled", urlOrJson);
47 }
48}
49
50export async function createFromUrl(
51 url: URL,

Callers 1

actionFunction · 0.90

Calls 6

isUrlFunction · 0.85
createFromUrlFunction · 0.85
isJSONFunction · 0.85
createFromRawJsonFunction · 0.85
isXMLFunction · 0.85
createFromRawXmlFunction · 0.85

Tested by

no test coverage detected