| 157 | } |
| 158 | |
| 159 | function extractRowObject(row, output, columnMap, moduleName) { |
| 160 | let count = 0; |
| 161 | for (const key of Object.keys(row)) { |
| 162 | const index = columnMap.get(key); |
| 163 | if (index === undefined) { |
| 164 | throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an undeclared column "${key}"`); |
| 165 | } |
| 166 | output[index] = row[key]; |
| 167 | count += 1; |
| 168 | } |
| 169 | if (count !== columnMap.size) { |
| 170 | throw new TypeError(`Virtual table module "${moduleName}" yielded a row with missing columns`); |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | function inferParameters({ length }) { |
| 175 | if (!Number.isInteger(length) || length < 0) { |