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

extractFieldPath.md

36 lines679 Bytes

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