| 464 | } |
| 465 | |
| 466 | export function toProperty(prop: string): boolean | number | string { |
| 467 | if (prop === 'true' || prop === 'yes') return true; |
| 468 | if (prop === 'false' || prop === 'no') return false; |
| 469 | if (/^-?(0|[1-9]\d*)$/.test(prop)) return Number.parseInt(prop, 10); |
| 470 | if (/^-?\d*\.\d+$/.test(prop)) return Number.parseFloat(prop); |
| 471 | return prop; |
| 472 | } |
| 473 | |
| 474 | // Initially based on http://philzimmermann.com/docs/human-oriented-base-32-encoding.txt |
| 475 | const BASE32_ALPHABET = '13456789EGKMPTWYabcdefhjnoqrsvxz'; |