MCPcopy Index your code
hub / github.com/danvk/webdiff / getOrNull

Function getOrNull

ts/CodeDiffContainer.tsx:72–84  ·  view source on GitHub ↗
(side: string, path: string, normalizeJSON: boolean)

Source from the content-addressed store, hash-verified

70
71// Either side can be empty (i.e. an add or a delete), in which case getOrNull resolves to null.
72async function getOrNull(side: string, path: string, normalizeJSON: boolean) {
73 if (!path) return null;
74 const data = new URLSearchParams();
75 data.set('path', path);
76 if (normalizeJSON) {
77 data.set('normalize_json', '1');
78 }
79 const response = await fetch(`/${side}/get_contents`, {
80 method: 'post',
81 body: data,
82 });
83 return response.text();
84}
85
86export interface CodeDiffContainerProps {
87 filePair: FilePair;

Callers 1

CodeDiffContainerFunction · 0.85

Calls 1

fetchFunction · 0.85

Tested by

no test coverage detected