✨ Introducing The Forge (#1072)
The Forge allows anyone to easily create their own Typebot Block. Closes #380
This commit is contained in:
12
packages/variables/parseGuessedTypeFromString.ts
Normal file
12
packages/variables/parseGuessedTypeFromString.ts
Normal file
@ -0,0 +1,12 @@
|
||||
export const parseGuessedTypeFromString = (value: string): unknown => {
|
||||
if (value === 'undefined') return undefined
|
||||
return safeJsonParse(value)
|
||||
}
|
||||
|
||||
const safeJsonParse = (value: string): unknown => {
|
||||
try {
|
||||
return JSON.parse(value)
|
||||
} catch {
|
||||
return value
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user