( changes: Record<string, unknown>, )
| 139 | * Undefined/null values are skipped since they represent "no change". |
| 140 | */ |
| 141 | export function buildPatchOps( |
| 142 | changes: Record<string, unknown>, |
| 143 | ): JsonPatchOperation[] { |
| 144 | return Object.entries(changes) |
| 145 | .filter(([, value]) => value !== undefined && value !== null) |
| 146 | .map(([key, value]) => ({ |
| 147 | op: "replace" as const, |
| 148 | path: `/${key}`, |
| 149 | value, |
| 150 | })); |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * Merge new patch operations into an existing array using an upsert-by-path strategy: |
no outgoing calls
no test coverage detected
searching dependent graphs…