| 80 | } |
| 81 | |
| 82 | export function decodeDecimal(fields: Iterator<string>): Decimal { |
| 83 | const r = fields.next() |
| 84 | if (r.done) throw new BadMessage('no more fields') |
| 85 | const s = r.value |
| 86 | if ( |
| 87 | s === null || |
| 88 | s === undefined || |
| 89 | s.length === 0 || |
| 90 | s === '2147483647' || |
| 91 | s === '9223372036854775807' || |
| 92 | s === '1.7976931348623157E308' || |
| 93 | s === '-9223372036854775808' |
| 94 | ) { |
| 95 | return UNSET_DECIMAL |
| 96 | } |
| 97 | return new Decimal(s) |
| 98 | } |
| 99 | |
| 100 | export function decodeLong(fields: Iterator<string>, showUnset = false): bigint { |
| 101 | const r = fields.next() |