Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

extractFieldPath.md

34 lines647 Bytes

1---
2id: extractFieldPath
3title: extractFieldPath
4---
5​
6```ts
7function extractFieldPath(expr): FieldPath | null;
8```
9​
10Defined in: [packages/db/src/query/expression-helpers.ts:110](https://github.com/TanStack/db/blob/main/packages/db/src/query/expression-helpers.ts#L110)
11​
12Extracts the field path from a PropRef expression.
13Returns null for non-ref expressions.
14​
15## Parameters
16​
17### expr
18​
19`BasicExpression`
20​
21The expression to extract from
22​
23## Returns
24​
25[`FieldPath`](../type-aliases/FieldPath.md) \| `null`
26​
27The field path array, or null
28​
29## Example
30​
31```typescript
32const field = extractFieldPath(someExpression)
33// Returns: ['product', 'category']
34```