Files
supabase/apps/docs/features/helpers.misc.ts
T
Charis f611fa11d9 feat (content api): add schemas and models for search results and guides (#35284)
Add models and GraphQL interface definitions for search results and guides (representing Markdown documents such as tutorials, etc.).

These aren't connected to anything yet, but putting them in a separate
PR to keep the review short and relatively simple.

Towards DOCS-214
2025-05-02 12:03:41 -04:00

18 lines
384 B
TypeScript

/**
* Creates a short random identifier
*/
export function nanoId(
/**
* The length of the identifier to generate
*/
length?: number
) {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
const l = length || 12
let id = ''
for (let i = 0; i < l; i++) {
id += chars.charAt(Math.floor(Math.random() * chars.length))
}
return id
}