MCPcopy
hub / github.com/AndrewWalsh/openapi-devtools / leafMapToEndpoints

Function leafMapToEndpoints

src/lib/leafmap-to-endpoints.ts:4–18  ·  view source on GitHub ↗
(leafMap: LeafMap)

Source from the content-addressed store, hash-verified

2import { pathToParts } from "./store-helpers/helpers";
3
4const leafMapToEndpoints = (leafMap: LeafMap): Array<Endpoint> => {
5 const endpoints: Array<Endpoint> = [];
6 for (const [host, pathData] of Object.entries(leafMap)) {
7 for (const [path, leaf] of Object.entries(pathData)) {
8 const endpoint: Endpoint = {
9 host,
10 parts: pathToParts(path),
11 pathname: path,
12 data: leaf.data,
13 };
14 endpoints.push(endpoint);
15 }
16 }
17 return endpoints;
18};
19
20export default leafMapToEndpoints;

Callers 2

endpointsMethod · 0.85

Calls 1

pathToPartsFunction · 0.90

Tested by

no test coverage detected