MCPcopy Create free account
hub / github.com/dailydotdev/apps / generateFallbackId

Function generateFallbackId

packages/shared/src/lib/strings.ts:3–13  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { markdownToHtmlBasic } from './markdownConversion';
2
3const generateFallbackId = (): string => {
4 const cryptoApi =
5 typeof globalThis !== 'undefined'
6 ? (globalThis.crypto as Crypto | undefined)
7 : undefined;
8 if (cryptoApi?.randomUUID) {
9 return cryptoApi.randomUUID().slice(0, 8);
10 }
11
12 return `${Date.now()}${Math.random().toString(36).slice(2)}`.slice(0, 8);
13};
14
15export const removeLinkTargetElement = (link: string): string => {
16 const { origin, pathname, search } = new URL(link);

Callers 1

generateNameFromEmailFunction · 0.85

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected