mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-05 07:47:56 +00:00
20 lines
553 B
TypeScript
20 lines
553 B
TypeScript
![]() |
import { EntityType } from '../types.generated';
|
||
|
|
||
|
/**
|
||
|
* Common helpers
|
||
|
*/
|
||
|
|
||
|
export const getActor = (): string | null => {
|
||
|
const cookie = new URLSearchParams(document.cookie.replaceAll('; ', '&'));
|
||
|
return cookie.get('actor');
|
||
|
};
|
||
|
|
||
|
export const toLowerCaseEntityType = (type: EntityType): string => {
|
||
|
return type.toLowerCase().replace(/[_]/g, '');
|
||
|
};
|
||
|
|
||
|
export const toTitleCase = (str: string): string => {
|
||
|
// eslint-disable-next-line no-useless-escape
|
||
|
return `${str.charAt(0).toUpperCase()}${str.substr(1)}`.replace(/[\-_]/g, '');
|
||
|
};
|