MCPcopy Create free account
hub / github.com/TanStack/db / visitSpreadSentinel

Function visitSpreadSentinel

packages/db/src/query/compiler/index.ts:1587–1611  ·  view source on GitHub ↗
(
    key: string,
    value: any,
    path: Array<string>,
    guards: Array<ConditionalSelectGuard>,
  )

Source from the content-addressed store, hash-verified

1585 }
1586
1587 const visitSpreadSentinel = (
1588 key: string,
1589 value: any,
1590 path: Array<string>,
1591 guards: Array<ConditionalSelectGuard>,
1592 ) => {
1593 const rest = key.slice(`__SPREAD_SENTINEL__`.length)
1594 const splitIndex = rest.lastIndexOf(`__`)
1595 const pathStr = splitIndex >= 0 ? rest.slice(0, splitIndex) : rest
1596 const isRefExpr =
1597 value &&
1598 typeof value === `object` &&
1599 `type` in value &&
1600 value.type === `ref`
1601 const sourcePath = isRefExpr
1602 ? (value as PropRef).path
1603 : pathStr.split(`.`).filter(Boolean)
1604
1605 if (pathStartsWith(targetPath, sourcePath)) {
1606 resultPaths.push({
1607 path: [...path, ...targetPath.slice(sourcePath.length)],
1608 guards,
1609 })
1610 }
1611 }
1612
1613 const visitSelectValue = (
1614 value: any,

Callers 1

visitSelectObjectFunction · 0.85

Calls 2

pathStartsWithFunction · 0.85
filterMethod · 0.80

Tested by

no test coverage detected