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

helper.ts

15 lines346 Bytes

1const RESERVED_RXDB_FIELDS = new Set([
2 `_rev`,
3 `_deleted`,
4 `_attachments`,
5 `_meta`,
6])
7​
8export function stripRxdbFields<T extends Record<string, unknown>>(obj: T): T {
9 const out: Record<string, unknown> = {}
10 for (const k of Object.keys(obj)) {
11 if (RESERVED_RXDB_FIELDS.has(k)) continue
12 out[k] = obj[k]
13 }
14 return out as T