mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 10:25:06 +03:00
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
18 lines
384 B
TypeScript
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
|
|
}
|