Function
attachVirtualPropsToSelected
(
selected: any,
row: Record<string, any>,
)
Source from the content-addressed store, hash-verified
| 1442 | } |
| 1443 | |
| 1444 | function attachVirtualPropsToSelected( |
| 1445 | selected: any, |
| 1446 | row: Record<string, any>, |
| 1447 | ): any { |
| 1448 | if (!selected || typeof selected !== `object`) { |
| 1449 | return selected |
| 1450 | } |
| 1451 | |
| 1452 | let needsMerge = false |
| 1453 | for (const prop of VIRTUAL_PROP_NAMES) { |
| 1454 | if (selected[prop] == null && prop in row) { |
| 1455 | needsMerge = true |
| 1456 | break |
| 1457 | } |
| 1458 | } |
| 1459 | |
| 1460 | if (!needsMerge) { |
| 1461 | return selected |
| 1462 | } |
| 1463 | |
| 1464 | for (const prop of VIRTUAL_PROP_NAMES) { |
| 1465 | if (selected[prop] == null && prop in row) { |
| 1466 | selected[prop] = row[prop] |
| 1467 | } |
| 1468 | } |
| 1469 | |
| 1470 | return selected |
| 1471 | } |
| 1472 | |
| 1473 | /** |
| 1474 | * Recursively maps optimized subqueries to their original queries for proper caching. |
Tested by
no test coverage detected