MCPcopy
hub / github.com/growthbook/growthbook / buildPatchOps

Function buildPatchOps

packages/back-end/src/revisions/util.ts:141–151  ·  view source on GitHub ↗
(
  changes: Record<string, unknown>,
)

Source from the content-addressed store, hash-verified

139 * Undefined/null values are skipped since they represent "no change".
140 */
141export 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:

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…