(value: DatabaseValue)
| 104 | } |
| 105 | |
| 106 | export function convertDatabaseValueToString(value: DatabaseValue) { |
| 107 | if (value === null) return "NULL"; |
| 108 | |
| 109 | if (typeof value === "string") return value; |
| 110 | |
| 111 | if (typeof value === "bigint" || typeof value === "number") { |
| 112 | return value.toString(); |
| 113 | } |
| 114 | |
| 115 | if (value instanceof ArrayBuffer || value instanceof Uint8Array) { |
| 116 | return btoa( |
| 117 | new Uint8Array(value).reduce( |
| 118 | (data, byte) => data + String.fromCharCode(byte), |
| 119 | "" |
| 120 | ) |
| 121 | ); |
| 122 | } |
| 123 | |
| 124 | return ""; |
| 125 | } |
no test coverage detected
searching dependent graphs…