(value)
| 5 | * @return {any} formatted value |
| 6 | */ |
| 7 | export default function format(value) { |
| 8 | if (value === '') return '' |
| 9 | if (value === 'true') return true |
| 10 | if (value === 'false') return false |
| 11 | /* Looks like JSON. Try to parse it */ |
| 12 | if (value && value.match(/^(\{[^\n]+\})/)) { |
| 13 | try { return JSON.parse(value) } catch (err) {} |
| 14 | } |
| 15 | return isNaN(value) ? value : Number(value) |
| 16 | } |
nothing calls this directly
no outgoing calls
no test coverage detected