MCPcopy Index your code
hub / github.com/adobe/react-spectrum / getUrl

Function getUrl

packages/dev/s2-docs/src/getPages.ts:54–70  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

52});
53
54function getUrl(name: string) {
55 if (name.endsWith('/index')) {
56 name = name.slice(0, -5);
57 }
58
59 let library = name.slice(0, name.indexOf('/'));
60 let baseUrl = getBaseUrl(library as any);
61 if (library === 'react-aria') {
62 return `${baseUrl}/${name.slice(11)}`;
63 } else if (library === 's2') {
64 return `${baseUrl}/${name.slice(3)}`;
65 } else if (!process.env.LIBRARY) {
66 return `http://localhost:1234/${name}`;
67 } else {
68 throw new Error('Unknown page: ' + name);
69 }
70}
71
72export function getCurrentPage(page: Page): Page {
73 // Remove .html

Callers 2

getPages.tsFile · 0.85
getCurrentPageFunction · 0.85

Calls 2

getBaseUrlFunction · 0.90
sliceMethod · 0.80

Tested by

no test coverage detected