MCPcopy Create free account
hub / github.com/tinyplex/tinybase / useReadme

Function useReadme

site/ui/Readme.tsx:17–40  ·  view source on GitHub ↗
(node: Node)

Source from the content-addressed store, hash-verified

15 bytes != null ? `${(bytes / 1000).toFixed(1)}kB` : '';
16
17export const useReadme = (node: Node): [string, string] => {
18 const metadata = usePackageData();
19 const modulesSizes = useModulesSizes();
20 const coverage = useCoverage();
21
22 Object.entries({
23 toKb,
24 metadata,
25 modulesSizes,
26 coverage,
27 getSizeTable: () => getSizeTable(modulesSizes),
28 getCoverageTable: () => getCoverageTable(coverage),
29 getGitHubAvatar,
30 }).forEach(([key, value]) => {
31 // eslint-disable-next-line react-hooks/immutability
32 (globalThis as any)[key] = value;
33 });
34
35 const substituteEval = (markdown: string): string =>
36 // eslint-disable-next-line react-hooks/unsupported-syntax
37 markdown.replace(/@@EVAL\("(.*?)"\)/gms, (_, script) => (0, eval)(script));
38
39 return [substituteEval(node.summary ?? ''), substituteEval(node.body ?? '')];
40};
41
42const getSizeTable = (modulesSizes: ModulesSizes) =>
43 `<table class='fixed'>

Callers 2

HomeFunction · 0.90
ReadmeFunction · 0.85

Calls 6

usePackageDataFunction · 0.90
useModulesSizesFunction · 0.90
useCoverageFunction · 0.90
getSizeTableFunction · 0.85
getCoverageTableFunction · 0.85
substituteEvalFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…