10 lines
320 B
TypeScript
10 lines
320 B
TypeScript
|
export const getId = (pathname: string) => {
|
||
|
const pathParts = pathname.substr(1).split("/");
|
||
|
return pathParts.length > 1 ? pathParts.splice(2) : undefined;
|
||
|
};
|
||
|
|
||
|
export const getLastId = (pathname: string) => {
|
||
|
const pathParts = getId(pathname);
|
||
|
return pathParts ? pathParts[pathParts.length - 1] : undefined;
|
||
|
};
|