(fields: Iterator<string>, showUnset = false)
| 61 | } |
| 62 | |
| 63 | export function decodeFloat(fields: Iterator<string>, showUnset = false): number { |
| 64 | const r = fields.next() |
| 65 | if (r.done) throw new BadMessage('no more fields') |
| 66 | const s = r.value |
| 67 | if (s === INFINITY_STR) return DOUBLE_INFINITY |
| 68 | if (showUnset) { |
| 69 | if (s === null || s === undefined || s.length === 0) return UNSET_DOUBLE |
| 70 | return parseFloat(s) |
| 71 | } |
| 72 | return parseFloat(s || '0') |
| 73 | } |
| 74 | |
| 75 | export function decodeBool(fields: Iterator<string>): boolean { |
| 76 | const r = fields.next() |
no test coverage detected