(value: unknown, subtypeOid: number, lookup: Lookup)
| 1907 | * for each finite bound when the range is not empty. |
| 1908 | */ |
| 1909 | const encodeRange = (value: unknown, subtypeOid: number, lookup: Lookup): Uint8Array => { |
| 1910 | const range = rangeValue(value) |
| 1911 | if (range.empty) return new Uint8Array([RANGE_EMPTY]) |
| 1912 | const codec = requireCodec(subtypeOid, lookup) |
| 1913 | const bounds: Array<Uint8Array> = [] |
| 1914 | if (range.lower !== null) bounds.push(codec.encode(range.lower)) |
| 1915 | if (range.upper !== null) bounds.push(codec.encode(range.upper)) |
| 1916 | const bytes = framed(1, bounds) |
| 1917 | bytes[0] = rangeFlags(range) |
| 1918 | return bytes |
| 1919 | } |
| 1920 | |
| 1921 | const writeRange = (sink: ValueSink, value: unknown, subtypeOid: number, lookup: Lookup): void => { |
| 1922 | const range = rangeValue(value) |
no test coverage detected