mirror of
https://github.com/supabase/supabase.git
synced 2026-07-06 19:44:24 +08:00
* Move all studio files from /studio to /apps/studio. * Move studio specific prettier ignores. * Fix the ui references from studio. * Fix the css imports. * Fix all package.json issues. * Fix the prettier setup for the studio app. * Add .turbo folder to prettierignore. * Fix the github workflows.
25 lines
585 B
TypeScript
25 lines
585 B
TypeScript
export function deepClone(obj: unknown) {
|
|
try {
|
|
return JSON.parse(JSON.stringify(obj))
|
|
} catch (e) {
|
|
throw e
|
|
}
|
|
}
|
|
|
|
export function formatClipboardValue(value: any) {
|
|
if (value === null) return ''
|
|
if (typeof value == 'object' || Array.isArray(value)) {
|
|
return JSON.stringify(value)
|
|
}
|
|
return value
|
|
}
|
|
|
|
export const copyToClipboard = (str: string, callback = () => {}) => {
|
|
const focused = window.document.hasFocus()
|
|
if (focused) {
|
|
window.navigator?.clipboard?.writeText(str).then(callback)
|
|
} else {
|
|
console.warn('Unable to copy to clipboard')
|
|
}
|
|
}
|