mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-23 08:47:50 +08:00
16 lines
230 B
TypeScript
16 lines
230 B
TypeScript
|
export default function fromString(value: any) {
|
||
|
if (value.match(/^\d*(\.\d+)?$/)) {
|
||
|
return Number(value)
|
||
|
}
|
||
|
|
||
|
if (value === 'true') {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
if (value === 'false') {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
return value
|
||
|
}
|