chore: Add docs to redirect.ts

This commit is contained in:
Sidharth Vinod 2022-11-15 11:13:54 +05:30
parent 82f63b056f
commit 18c27c6f1d
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD

View File

@ -1,3 +1,7 @@
/**
* Extracts the base slug from the old URL.
* @param link - The old URL.
*/
export const getBaseFile = (link: string): string => {
const url = new URL(link);
if (
@ -59,6 +63,11 @@ const redirectMap: Record<string, string> = {
'user-journey': 'syntax/userJourney',
};
/**
*
* @param link - The old documentation URL.
* @returns The new documentation path.
*/
export const getRedirect = (link: string): string | undefined => {
const base = getBaseFile(link);
return redirectMap[base];