MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getUrl

Function getUrl

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

Source from the content-addressed store, hash-verified

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